All of lore.kernel.org
 help / color / mirror / Atom feed
* New Hypercall Declaration
@ 2010-09-30 22:02 Nimgaonkar, Satyajeet
  2010-09-30 22:47 ` Dan Magenheimer
  0 siblings, 1 reply; 9+ messages in thread
From: Nimgaonkar, Satyajeet @ 2010-09-30 22:02 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com


[-- Attachment #1.1: Type: text/plain, Size: 1780 bytes --]

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){

    int rc;

    /* Hypercall definitions */

    DECLARE_HYPERCALL;
    hypercall.op     = __HYPERVISOR_jeet1;
    rc = do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] = 0;
    hypercall.arg[1] = 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 handle goes as the first argument for the function do_xen_hypercall()
         */

     handle = xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);


     rc = hypercall_test(handle);
     printf ("Hypercall Details: %d\n", rc);

     xc_interface_close(handle);

     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

[-- Attachment #1.2: Type: text/html, Size: 3553 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: New Hypercall Declaration
  2010-09-30 22:02 New Hypercall Declaration Nimgaonkar, Satyajeet
@ 2010-09-30 22:47 ` Dan Magenheimer
  2010-09-30 22:55   ` Nimgaonkar, Satyajeet
  2010-10-07 17:36   ` Nimgaonkar, Satyajeet
  0 siblings, 2 replies; 9+ messages in thread
From: Dan Magenheimer @ 2010-09-30 22:47 UTC (permalink / raw)
  To: Nimgaonkar, Satyajeet, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 3235 bytes --]

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 hypervisor, but unless the hypervisor is modified to recognize the new hypercall (#56) and do something with it, the hypervisor will generate a return value of -1 (essentially saying "I don't recognize this hypercall 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/compat, 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 will need to ensure that you are properly building, installing, and booting your newly modified hypervisor.

 

Printk's done inside the hypervisor can be viewed using "xm dmesg" or via a properly configured serial port.

 

Use "xm info" and look at cc_compile_date to ensure you are booting your newly modified hypervisor.

 

Hope that helps,

Dan

 

From: Nimgaonkar, Satyajeet [mailto:SatyajeetNimgaonkar@my.unt.edu] 
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                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){
    
    int rc; 
     
    /* Hypercall definitions */
     
    DECLARE_HYPERCALL;
    hypercall.op     = __HYPERVISOR_jeet1;
    rc = do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] = 0;
    hypercall.arg[1] = 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 handle goes as the first argument for the function do_xen_hypercall()
         */
         
     handle = xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);
     
     
     rc = hypercall_test(handle);
     printf ("Hypercall Details: %d\n", rc);
     
     xc_interface_close(handle);     
     
     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

[-- Attachment #1.2: Type: text/html, Size: 8519 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: New Hypercall Declaration
  2010-09-30 22:47 ` Dan Magenheimer
@ 2010-09-30 22:55   ` Nimgaonkar, Satyajeet
  2010-10-07 17:36   ` Nimgaonkar, Satyajeet
  1 sibling, 0 replies; 9+ messages in thread
From: Nimgaonkar, Satyajeet @ 2010-09-30 22:55 UTC (permalink / raw)
  To: Dan Magenheimer, xen-devel@lists.xensource.com


[-- Attachment #1.1: Type: text/plain, Size: 3434 bytes --]

Thanks Dan, that makes some sense. I will try on this lines now.
________________________________
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 hypervisor, but unless the hypervisor is modified to recognize the new hypercall (#56) and do something with it, the hypervisor will generate a return value of -1 (essentially saying “I don’t recognize this hypercall 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/compat, 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 will need to ensure that you are properly building, installing, and booting your newly modified hypervisor.

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

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

Hope that helps,
Dan

From: Nimgaonkar, Satyajeet [mailto:SatyajeetNimgaonkar@my.unt.edu]
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                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){

    int rc;

    /* Hypercall definitions */

    DECLARE_HYPERCALL;
    hypercall.op     = __HYPERVISOR_jeet1;
    rc = do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] = 0;
    hypercall.arg[1] = 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 handle goes as the first argument for the function do_xen_hypercall()
         */

     handle = xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);


     rc = hypercall_test(handle);
     printf ("Hypercall Details: %d\n", rc);

     xc_interface_close(handle);

     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

[-- Attachment #1.2: Type: text/html, Size: 8844 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: New Hypercall Declaration
  2010-09-30 22:47 ` Dan Magenheimer
  2010-09-30 22:55   ` Nimgaonkar, Satyajeet
@ 2010-10-07 17:36   ` Nimgaonkar, Satyajeet
  2010-10-07 18:07     ` Dan Magenheimer
  1 sibling, 1 reply; 9+ messages in thread
From: Nimgaonkar, Satyajeet @ 2010-10-07 17:36 UTC (permalink / raw)
  To: Dan Magenheimer, xen-devel@lists.xensource.com


[-- Attachment #1.1: Type: text/plain, Size: 5751 bytes --]

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(void);

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=0;
    //int cmd=1;
    //
    //int test;
    /* Hypercall definitions */

    DECLARE_HYPERCALL;
    hypercall.op     = __HYPERVISOR_jeet1;
    rc = do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] = 0;
    hypercall.arg[1] = (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 invoke 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 handle goes as the first argument for the function do_xen_hypercall()
         */

     handle = xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);


     rc = 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 xen. 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.
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 code 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 the new hypercall (#56) and do something with it, the hypervisor will generate a return value of -1 (essentially saying “I don’t recognize this hypercall 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/compat, 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 will need to ensure that you are properly building, installing, and booting your newly modified hypervisor.

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

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

Hope that helps,
Dan

From: Nimgaonkar, Satyajeet [mailto:SatyajeetNimgaonkar@my.unt.edu]
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                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){

    int rc;

    /* Hypercall definitions */

    DECLARE_HYPERCALL;
    hypercall.op     = __HYPERVISOR_jeet1;
    rc = do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] = 0;
    hypercall.arg[1] = 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 handle goes as the first argument for the function do_xen_hypercall()
         */

     handle = xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);


     rc = hypercall_test(handle);
     printf ("Hypercall Details: %d\n", rc);

     xc_interface_close(handle);

     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

[-- Attachment #1.2: Type: text/html, Size: 13767 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: New Hypercall Declaration
  2010-10-07 17:36   ` Nimgaonkar, Satyajeet
@ 2010-10-07 18:07     ` Dan Magenheimer
  2010-10-07 19:11       ` Keir Fraser
  2010-10-07 19:28       ` Nimgaonkar, Satyajeet
  0 siblings, 2 replies; 9+ messages in thread
From: Dan Magenheimer @ 2010-10-07 18:07 UTC (permalink / raw)
  To: Nimgaonkar, Satyajeet, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 6578 bytes --]

The hypercall_table and hypercall_args_table are initialized sequences of quads and bytes.  Even though you have put 56 in the comment, you are initializing 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 with the appropriate values.  (The assembler syntax 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 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(void); 

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=0; 
    //int cmd=1;
    //
    //int test;
    /* Hypercall definitions */
     
    DECLARE_HYPERCALL;
    hypercall.op     = __HYPERVISOR_jeet1;
    rc = do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] = 0;
    hypercall.arg[1] = (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 invoke 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 handle goes as the first argument for the function do_xen_hypercall()
         */
         
     handle = xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);
     
     
     rc = 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 xen. 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.
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 code 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 the new hypercall (#56) and do something with it, the hypervisor will generate a return value of -1 (essentially saying "I don't recognize this hypercall 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/compat, 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 will need to ensure that you are properly building, installing, and booting your newly modified hypervisor.

 

Printk's done inside the hypervisor can be viewed using "xm dmesg" or via a properly configured serial port.

 

Use "xm info" and look at cc_compile_date to ensure you are booting your newly modified hypervisor.

 

Hope that helps,

Dan

 

From: Nimgaonkar, Satyajeet [mailto:SatyajeetNimgaonkar@my.unt.edu] 
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                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){
    
    int rc; 
     
    /* Hypercall definitions */
     
    DECLARE_HYPERCALL;
    hypercall.op     = __HYPERVISOR_jeet1;
    rc = do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] = 0;
    hypercall.arg[1] = 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 handle goes as the first argument for the function do_xen_hypercall()
         */
         
     handle = xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);
     
     
     rc = hypercall_test(handle);
     printf ("Hypercall Details: %d\n", rc);
     
     xc_interface_close(handle);     
     
     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

[-- Attachment #1.2: Type: text/html, Size: 16899 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: New Hypercall Declaration
  2010-10-07 18:07     ` Dan Magenheimer
@ 2010-10-07 19:11       ` Keir Fraser
  2010-10-07 19:28       ` Nimgaonkar, Satyajeet
  1 sibling, 0 replies; 9+ messages in thread
From: Keir Fraser @ 2010-10-07 19:11 UTC (permalink / raw)
  To: Dan Magenheimer, Nimgaonkar, Satyajeet, xen-devel

And furthermore, do_jeet() needs to return a long, not void.

 -- Keir

On 07/10/2010 19:07, "Dan Magenheimer" <dan.magenheimer@oracle.com> wrote:

> The hypercall_table and hypercall_args_table are initialized sequences of
> quads and bytes.  Even though you have put 56 in the comment, you are
> initializing 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
> with the appropriate values.  (The assembler syntax 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 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(void);
> 
> 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=0; 
>     //int cmd=1;
>     //
>     //int test;
>     /* Hypercall definitions */
>      
>     DECLARE_HYPERCALL;
>     hypercall.op     = __HYPERVISOR_jeet1;
>     rc = do_xen_hypercall(handle, &hypercall);
>     hypercall.arg[0] = 0;
>     hypercall.arg[1] = (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 invoke
> 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 handle goes as the first argument for the function
> do_xen_hypercall()
>          */
>          
>      handle = xc_interface_open();
>      printf ("Acquired handle to Xen Hypervisor:%d\n",handle);
>      
>      
>      rc = 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 xen.
> 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.
> 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 code 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 the new hypercall (#56) and
> do something with it, the hypervisor will generate a return value of -1
> (essentially saying ³I don¹t recognize this hypercall 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/compat, 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 will need to ensure that you are
> properly building, installing, and booting your newly modified hypervisor.
>  
> Printk¹s done inside the hypervisor can be viewed using ³xm dmesg² or via a
> properly configured serial port.
>  
> Use ³xm info² and look at cc_compile_date to ensure you are booting your newly
> modified hypervisor.
>  
> Hope that helps,
> Dan
>  
> 
> From: Nimgaonkar, Satyajeet [mailto:SatyajeetNimgaonkar@my.unt.edu]
> 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               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){
>     
>     int rc; 
>      
>     /* Hypercall definitions */
>      
>     DECLARE_HYPERCALL;
>     hypercall.op     = __HYPERVISOR_jeet1;
>     rc = do_xen_hypercall(handle, &hypercall);
>     hypercall.arg[0] = 0;
>     hypercall.arg[1] = 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 handle goes as the first argument for the function
> do_xen_hypercall()
>          */
>          
>      handle = xc_interface_open();
>      printf ("Acquired handle to Xen Hypervisor:%d\n",handle);
>      
>      
>      rc = hypercall_test(handle);
>      printf ("Hypercall Details: %d\n", rc);
>      
>      xc_interface_close(handle);
>      
>      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
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: New Hypercall Declaration
  2010-10-07 18:07     ` Dan Magenheimer
  2010-10-07 19:11       ` Keir Fraser
@ 2010-10-07 19:28       ` Nimgaonkar, Satyajeet
  2010-10-07 19:39         ` Dan Magenheimer
  1 sibling, 1 reply; 9+ messages in thread
From: Nimgaonkar, Satyajeet @ 2010-10-07 19:28 UTC (permalink / raw)
  To: Dan Magenheimer, xen-devel@lists.xensource.com


[-- Attachment #1.1: Type: text/plain, Size: 6826 bytes --]

Hi Dan,
           But if you look at xen.h, 48-55 are architecture specific hypercalls, and if I do rept endr from 49-55 as per your advice wouldn't I be overriding those hypercalls?
________________________________
From: Dan Magenheimer [dan.magenheimer@oracle.com]
Sent: Thursday, October 07, 2010 12:07 PM
To: Nimgaonkar, Satyajeet; xen-devel@lists.xensource.com
Subject: RE: [Xen-devel] New Hypercall Declaration

The hypercall_table and hypercall_args_table are initialized sequences of quads and bytes.  Even though you have put 56 in the comment, you are initializing 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 with the appropriate values.  (The assembler syntax 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 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(void);

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=0;
    //int cmd=1;
    //
    //int test;
    /* Hypercall definitions */

    DECLARE_HYPERCALL;
    hypercall.op     = __HYPERVISOR_jeet1;
    rc = do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] = 0;
    hypercall.arg[1] = (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 invoke 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 handle goes as the first argument for the function do_xen_hypercall()
         */

     handle = xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);


     rc = 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 xen. 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.
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 code 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 the new hypercall (#56) and do something with it, the hypervisor will generate a return value of -1 (essentially saying “I don’t recognize this hypercall 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/compat, 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 will need to ensure that you are properly building, installing, and booting your newly modified hypervisor.

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

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

Hope that helps,
Dan

From: Nimgaonkar, Satyajeet [mailto:SatyajeetNimgaonkar@my.unt.edu]
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                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){

    int rc;

    /* Hypercall definitions */

    DECLARE_HYPERCALL;
    hypercall.op     = __HYPERVISOR_jeet1;
    rc = do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] = 0;
    hypercall.arg[1] = 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 handle goes as the first argument for the function do_xen_hypercall()
         */

     handle = xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);


     rc = hypercall_test(handle);
     printf ("Hypercall Details: %d\n", rc);

     xc_interface_close(handle);

     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

[-- Attachment #1.2: Type: text/html, Size: 17270 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: New Hypercall Declaration
  2010-10-07 19:28       ` Nimgaonkar, Satyajeet
@ 2010-10-07 19:39         ` Dan Magenheimer
  2010-10-11 21:46           ` Nimgaonkar, Satyajeet
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Magenheimer @ 2010-10-07 19:39 UTC (permalink / raw)
  To: Nimgaonkar, Satyajeet, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 7406 bytes --]

On x86, the table entries are currently filled in (with the .rept) with do_ni_hypercall and zeroes.  I believe they might be used on ia64, but you are changing a x86-specific source file.

 

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

 

Hi Dan,
           But if you look at xen.h, 48-55 are architecture specific hypercalls, and if I do rept endr from 49-55 as per your advice wouldn't I be overriding those hypercalls? 

  _____  

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

The hypercall_table and hypercall_args_table are initialized sequences of quads and bytes.  Even though you have put 56 in the comment, you are initializing 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 with the appropriate values.  (The assembler syntax 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 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(void); 

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=0; 
    //int cmd=1;
    //
    //int test;
    /* Hypercall definitions */
     
    DECLARE_HYPERCALL;
    hypercall.op     = __HYPERVISOR_jeet1;
    rc = do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] = 0;
    hypercall.arg[1] = (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 invoke 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 handle goes as the first argument for the function do_xen_hypercall()
         */
         
     handle = xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);
     
     
     rc = 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 xen. 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.
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 code 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 the new hypercall (#56) and do something with it, the hypervisor will generate a return value of -1 (essentially saying "I don't recognize this hypercall 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/compat, 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 will need to ensure that you are properly building, installing, and booting your newly modified hypervisor.

 

Printk's done inside the hypervisor can be viewed using "xm dmesg" or via a properly configured serial port.

 

Use "xm info" and look at cc_compile_date to ensure you are booting your newly modified hypervisor.

 

Hope that helps,

Dan

 

From: Nimgaonkar, Satyajeet [mailto:SatyajeetNimgaonkar@my.unt.edu] 
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                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){
    
    int rc; 
     
    /* Hypercall definitions */
     
    DECLARE_HYPERCALL;
    hypercall.op     = __HYPERVISOR_jeet1;
    rc = do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] = 0;
    hypercall.arg[1] = 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 handle goes as the first argument for the function do_xen_hypercall()
         */
         
     handle = xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);
     
     
     rc = hypercall_test(handle);
     printf ("Hypercall Details: %d\n", rc);
     
     xc_interface_close(handle);     
     
     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

[-- Attachment #1.2: Type: text/html, Size: 19633 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: New Hypercall Declaration
  2010-10-07 19:39         ` Dan Magenheimer
@ 2010-10-11 21:46           ` Nimgaonkar, Satyajeet
  0 siblings, 0 replies; 9+ messages in thread
From: Nimgaonkar, Satyajeet @ 2010-10-11 21:46 UTC (permalink / raw)
  To: Dan Magenheimer, xen-devel@lists.xensource.com


[-- Attachment #1.1: Type: text/plain, Size: 7587 bytes --]

Hi Dan,
            Thanks for all your advice, I got my hypercall working....

Regards,
Satyajeet Nimgaonkar
________________________________
From: Dan Magenheimer [dan.magenheimer@oracle.com]
Sent: Thursday, October 07, 2010 1:39 PM
To: Nimgaonkar, Satyajeet; xen-devel@lists.xensource.com
Subject: RE: [Xen-devel] New Hypercall Declaration

On x86, the table entries are currently filled in (with the .rept) with do_ni_hypercall and zeroes.  I believe they might be used on ia64, but you are changing a x86-specific source file.

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

Hi Dan,
           But if you look at xen.h, 48-55 are architecture specific hypercalls, and if I do rept endr from 49-55 as per your advice wouldn't I be overriding those hypercalls?
________________________________
From: Dan Magenheimer [dan.magenheimer@oracle.com]
Sent: Thursday, October 07, 2010 12:07 PM
To: Nimgaonkar, Satyajeet; xen-devel@lists.xensource.com
Subject: RE: [Xen-devel] New Hypercall Declaration
The hypercall_table and hypercall_args_table are initialized sequences of quads and bytes.  Even though you have put 56 in the comment, you are initializing 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 with the appropriate values.  (The assembler syntax 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 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(void);

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=0;
    //int cmd=1;
    //
    //int test;
    /* Hypercall definitions */

    DECLARE_HYPERCALL;
    hypercall.op     = __HYPERVISOR_jeet1;
    rc = do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] = 0;
    hypercall.arg[1] = (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 invoke 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 handle goes as the first argument for the function do_xen_hypercall()
         */

     handle = xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);


     rc = 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 xen. 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.
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 code 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 the new hypercall (#56) and do something with it, the hypervisor will generate a return value of -1 (essentially saying “I don’t recognize this hypercall 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/compat, 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 will need to ensure that you are properly building, installing, and booting your newly modified hypervisor.

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

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

Hope that helps,
Dan

From: Nimgaonkar, Satyajeet [mailto:SatyajeetNimgaonkar@my.unt.edu]
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                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){

    int rc;

    /* Hypercall definitions */

    DECLARE_HYPERCALL;
    hypercall.op     = __HYPERVISOR_jeet1;
    rc = do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] = 0;
    hypercall.arg[1] = 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 handle goes as the first argument for the function do_xen_hypercall()
         */

     handle = xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);


     rc = hypercall_test(handle);
     printf ("Hypercall Details: %d\n", rc);

     xc_interface_close(handle);

     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

[-- Attachment #1.2: Type: text/html, Size: 20053 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-10-11 21:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-30 22:02 New Hypercall Declaration Nimgaonkar, Satyajeet
2010-09-30 22:47 ` Dan Magenheimer
2010-09-30 22:55   ` Nimgaonkar, Satyajeet
2010-10-07 17:36   ` Nimgaonkar, Satyajeet
2010-10-07 18:07     ` Dan Magenheimer
2010-10-07 19:11       ` Keir Fraser
2010-10-07 19:28       ` Nimgaonkar, Satyajeet
2010-10-07 19:39         ` Dan Magenheimer
2010-10-11 21:46           ` Nimgaonkar, Satyajeet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.