X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_usr%2Fv3_user_host_dev.c;h=a0c1a9987bfb2ab4780e4afd3d9919097066d0c6;hb=4b7f19c51325601d7e7569e6101c7bfcdf984ef7;hp=8fe121ab4b278936fe2a17ab3c0123906cbf3734;hpb=5ac6ebe490fe6ebb948dd68736c693a3bb2f82dc;p=palacios.git diff --git a/linux_usr/v3_user_host_dev.c b/linux_usr/v3_user_host_dev.c index 8fe121a..a0c1a99 100644 --- a/linux_usr/v3_user_host_dev.c +++ b/linux_usr/v3_user_host_dev.c @@ -2,6 +2,8 @@ #include #include #include +#include +#include #include "v3_user_host_dev.h" @@ -10,12 +12,17 @@ int v3_user_host_dev_rendezvous(char *vmdev, char *url) { int vmfd; int devfd; + char buf[256]; + + + strcpy(buf,url); + buf[255]=0; if ((vmfd=open(vmdev,O_RDWR))<0) { return -1; } - devfd = ioctl(vmfd,V3_VM_HOST_DEV_CONNECT,url); + devfd = ioctl(vmfd,V3_VM_HOST_DEV_CONNECT,buf); close(vmfd); @@ -32,7 +39,9 @@ int v3_user_host_dev_have_request(int devfd) { uint64_t len; - return ioctl(devfd,V3_HOST_DEV_HOST_REQUEST_SIZE_IOCTL,&len)==1; + int rc=ioctl(devfd,V3_HOST_DEV_HOST_REQUEST_SIZE_IOCTL,&len); + + return rc==1; } int v3_user_host_dev_pull_request(int devfd, struct palacios_host_dev_host_request_response **req) @@ -46,7 +55,11 @@ int v3_user_host_dev_pull_request(int devfd, struct palacios_host_dev_host_reque return -1; } else { struct palacios_host_dev_host_request_response *r = malloc(len); - + + if (!r) { + return -1; + } + rc=ioctl(devfd, V3_HOST_DEV_HOST_REQUEST_PULL_IOCTL,r); if (rc<=0) { @@ -106,11 +119,24 @@ uint64_t v3_user_host_dev_write_guest_mem(int devfd, void *gpa, void *src, uint6 return do_user(devfd,&op); } -int v3_user_host_dev_inject_irq(int devfd, uint8_t irq) +int v3_user_host_dev_raise_irq(int devfd, uint8_t irq) +{ + struct palacios_host_dev_user_op op; + + op.type= PALACIOS_HOST_DEV_USER_REQUEST_IRQ_RAISE_GUEST; + op.gpa=0; + op.data=0; + op.len=0; + op.irq=irq; + + return do_user(devfd,&op); +} + +int v3_user_host_dev_lower_irq(int devfd, uint8_t irq) { struct palacios_host_dev_user_op op; - op.type= PALACIOS_HOST_DEV_USER_REQUEST_IRQ_GUEST; + op.type= PALACIOS_HOST_DEV_USER_REQUEST_IRQ_LOWER_GUEST; op.gpa=0; op.data=0; op.len=0;