From: Peter Dinda Date: Wed, 20 Apr 2011 01:20:34 +0000 (-0500) Subject: Update to host device interface plus changes to affected devices X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=0dc44b36f3d1f95efe8fe96484e76e65aeebd197;p=palacios.git Update to host device interface plus changes to affected devices --- diff --git a/palacios/include/interfaces/vmm_host_dev.h b/palacios/include/interfaces/vmm_host_dev.h index 138839f..57fea7c 100644 --- a/palacios/include/interfaces/vmm_host_dev.h +++ b/palacios/include/interfaces/vmm_host_dev.h @@ -78,9 +78,12 @@ typedef enum { V3_BUS_CLASS_DIRECT, V3_BUS_CLASS_PCI } v3_bus_class_t; #ifdef __V3VEE__ +struct v3_vm_info; + v3_host_dev_t v3_host_dev_open(char *impl, v3_bus_class_t bus, - v3_guest_dev_t gdev); + v3_guest_dev_t gdev, + struct v3_vm_info *vm); int v3_host_dev_close(v3_host_dev_t hdev); @@ -124,10 +127,12 @@ struct v3_host_dev_hooks { // this device is attached to and an opaque pointer back to the // guest device. It returns an opaque representation of // the host device it has attached to, with zero indicating - // failure + // failure. The host_priv_data arguement supplies to the + // host the pointer that the VM was originally registered with v3_host_dev_t (*open)(char *impl, v3_bus_class_t bus, - v3_guest_dev_t gdev); + v3_guest_dev_t gdev, + void *host_priv_data); int (*close)(v3_host_dev_t hdev); @@ -202,9 +207,6 @@ int v3_host_dev_raise_irq(v3_host_dev_t hostdev, /* These functions allow the host to read and write the guest memory by physical address, for example to implement DMA - - These functions are incremental - that is, they can return - a smaller amount than requested */ uint64_t v3_host_dev_read_guest_mem(v3_host_dev_t hostdev, v3_guest_dev_t guest_dev, diff --git a/palacios/src/devices/generic.c b/palacios/src/devices/generic.c index 21b2fc4..73b778a 100644 --- a/palacios/src/devices/generic.c +++ b/palacios/src/devices/generic.c @@ -677,7 +677,7 @@ static int generic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { v3_remove_device(dev); return -1; } else { - state->host_dev = v3_host_dev_open(host_dev,V3_BUS_CLASS_DIRECT,dev); + state->host_dev = v3_host_dev_open(host_dev,V3_BUS_CLASS_DIRECT,dev,vm); if (!(state->host_dev)) { PrintError("generic (%s): unable to open host device \"%s\"\n", state->name,host_dev); v3_remove_device(dev); diff --git a/palacios/src/devices/pci_front.c b/palacios/src/devices/pci_front.c index 87a4e0a..eb73076 100644 --- a/palacios/src/devices/pci_front.c +++ b/palacios/src/devices/pci_front.c @@ -791,7 +791,7 @@ static int pci_front_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) return -1; } - if (!(state->host_dev=v3_host_dev_open(url,V3_BUS_CLASS_PCI,dev))) { + if (!(state->host_dev=v3_host_dev_open(url,V3_BUS_CLASS_PCI,dev,vm))) { PrintError("pci_front (%s): unable to attach to host device %s\n",state->name, url); v3_remove_device(dev); return -1; diff --git a/palacios/src/interfaces/vmm_host_dev.c b/palacios/src/interfaces/vmm_host_dev.c index 064d17f..531fc87 100644 --- a/palacios/src/interfaces/vmm_host_dev.c +++ b/palacios/src/interfaces/vmm_host_dev.c @@ -29,12 +29,13 @@ struct v3_host_dev_hooks * host_dev_hooks = 0; v3_host_dev_t v3_host_dev_open(char *impl, v3_bus_class_t bus, - v3_guest_dev_t gdev) + v3_guest_dev_t gdev, + struct v3_vm_info *vm) { V3_ASSERT(host_dev_hooks != NULL); V3_ASSERT(host_dev_hooks->open != NULL); - return host_dev_hooks->open(impl,bus,gdev); + return host_dev_hooks->open(impl,bus,gdev,vm->host_priv_data); } int v3_host_dev_close(v3_host_dev_t hdev)