X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_module%2Fiface-host-dev.c;h=9940ceb338958f7e45c2b0b645a227bb69daf94c;hb=ec9f38e306b02bb98029fb950bcb4d0bd0c3aed2;hp=680d7537515f90192a36fff067af73d8c95a10c0;hpb=e8ee9e1536b3fa2e69f5537a90f5e034e9529248;p=palacios.git diff --git a/linux_module/iface-host-dev.c b/linux_module/iface-host-dev.c index 680d753..9940ceb 100644 --- a/linux_module/iface-host-dev.c +++ b/linux_module/iface-host-dev.c @@ -126,14 +126,14 @@ struct palacios_host_dev { #define DEEP_DEBUG 0 #define SHALLOW_DEBUG 0 -#if DEEP_DEBUG -#define DEEP_DEBUG_PRINT(fmt, args...) DEBUG((fmt), ##args) +#if DEEP_DEBUG == 1 +#define DEEP_DEBUG_PRINT(fmt, args...) DEBUG(fmt, ##args) #else #define DEEP_DEBUG_PRINT(fmt, args...) #endif -#if SHALLOW_DEBUG -#define SHALLOW_DEBUG_PRINT(fmt, args...) INFO((fmt), ##args) +#if SHALLOW_DEBUG == 1 +#define SHALLOW_DEBUG_PRINT(fmt, args...) INFO(fmt, ##args) #else #define SHALLOW_DEBUG_PRINT(fmt, args...) #endif @@ -149,6 +149,7 @@ struct palacios_host_device_user { char url[MAX_URL]; // what is the url describing the device v3_guest_dev_t guestdev; // what is the palacios-side device + v3_guest_dev_intr_t guestintr; // what is the palacios-side device interrupt info wait_queue_head_t user_wait_queue; // user space processes waiting on us (should be only one) wait_queue_head_t host_wait_queue; // host threads (should only be one) waiting on user space @@ -434,11 +435,18 @@ static long host_dev_ioctl(struct file * fp, unsigned int val, unsigned long arg } break; - case PALACIOS_HOST_DEV_USER_REQUEST_IRQ_GUEST: { + case PALACIOS_HOST_DEV_USER_REQUEST_IRQ_RAISE_GUEST: { - DEEP_DEBUG_PRINT("palacios: hostdev: irq guest\n"); + DEEP_DEBUG_PRINT("palacios: hostdev: irq raise guest\n"); - return v3_host_dev_raise_irq(dev, dev->guestdev, op.irq); + return v3_host_dev_raise_irq(dev, dev->guestdev, dev->guestintr, op.irq); + } + break; + case PALACIOS_HOST_DEV_USER_REQUEST_IRQ_LOWER_GUEST: { + + DEEP_DEBUG_PRINT("palacios: hostdev: irq lower guest\n"); + + return v3_host_dev_lower_irq(dev, dev->guestdev, dev->guestintr, op.irq); } break; @@ -728,6 +736,7 @@ static int palacios_host_dev_rendezvous(struct palacios_host_device_user *dev) static v3_host_dev_t palacios_host_dev_open_deferred(char *url, v3_bus_class_t bus, v3_guest_dev_t gdev, + v3_guest_dev_intr_t gintr, void *host_priv_data) { struct v3_guest *guest= (struct v3_guest*)host_priv_data; @@ -786,6 +795,8 @@ static v3_host_dev_t palacios_host_dev_open_deferred(char *url, dev->guestdev = gdev; + dev->guestintr = gintr; + dev->guest = guest; palacios_spinlock_init(&(dev->lock)); @@ -862,13 +873,13 @@ static uint64_t palacios_host_dev_read_io(v3_host_dev_t hostdev, DEEP_DEBUG_PRINT("palacios: hostdev: read io port 0x%x\n",port); - palacios_spinlock_lock_irqsave(&(dev->lock),f); if (palacios_host_dev_rendezvous(dev)) { - palacios_spinlock_unlock_irqrestore(&(dev->lock),f); + //palacios_spinlock_unlock_irqrestore(&(dev->lock),f); ERROR("palacios: ignoring request as user side is not connected (and did not rendezvous) for host device \"%s\"\n",dev->url); return 0; } + palacios_spinlock_lock_irqsave(&(dev->lock),f); if (dev->waiting) { palacios_spinlock_unlock_irqrestore(&(dev->lock),f); @@ -937,13 +948,13 @@ static uint64_t palacios_host_dev_read_mem(v3_host_dev_t hostdev, DEEP_DEBUG_PRINT("palacios: hostdev: read mem 0x%p\n",gpa); - palacios_spinlock_lock_irqsave(&(dev->lock),f); if (palacios_host_dev_rendezvous(dev)) { - palacios_spinlock_unlock_irqrestore(&(dev->lock),f); + //palacios_spinlock_unlock_irqrestore(&(dev->lock),f); ERROR("palacios: ignoring request as user side is not connected (and did not rendezvous) for host device \"%s\"\n",dev->url); return 0; } + palacios_spinlock_lock_irqsave(&(dev->lock),f); if (dev->waiting) { palacios_spinlock_unlock_irqrestore(&(dev->lock),f); @@ -1007,15 +1018,15 @@ static uint64_t palacios_host_dev_read_conf(v3_host_dev_t hostdev, unsigned long f; uint64_t op_len; - DEEP_DEBUG_PRINT("palacios: hostdev: read conf 0x%p\n",(void*)offset); + DEEP_DEBUG_PRINT("palacios: hostdev: read conf 0x%p (len=%lld)\n",(void*)offset, len); - palacios_spinlock_lock_irqsave(&(dev->lock),f); if (palacios_host_dev_rendezvous(dev)) { - palacios_spinlock_unlock_irqrestore(&(dev->lock),f); + //palacios_spinlock_unlock_irqrestore(&(dev->lock),f); ERROR("palacios: ignoring request as user side is not connected (and did not rendezvous) for host device \"%s\"\n",dev->url); return 0; } + palacios_spinlock_lock_irqsave(&(dev->lock),f); if (dev->waiting) { palacios_spinlock_unlock_irqrestore(&(dev->lock),f); @@ -1082,13 +1093,13 @@ static uint64_t palacios_host_dev_write_io(v3_host_dev_t hostdev, DEEP_DEBUG_PRINT("palacios: hostdev: write io port 0x%x \n",port); - palacios_spinlock_lock_irqsave(&(dev->lock),f); if (palacios_host_dev_rendezvous(dev)) { - palacios_spinlock_unlock_irqrestore(&(dev->lock),f); + //palacios_spinlock_unlock_irqrestore(&(dev->lock),f); ERROR("palacios: ignoring request as user side is not connected (and did not rendezvous) for host device \"%s\"\n",dev->url); return 0; } + palacios_spinlock_lock_irqsave(&(dev->lock),f); if (dev->waiting) { palacios_spinlock_unlock_irqrestore(&(dev->lock),f); @@ -1155,14 +1166,15 @@ static uint64_t palacios_host_dev_write_mem(v3_host_dev_t hostdev, DEEP_DEBUG_PRINT("palacios: hostdev: write mem 0x%p\n",gpa); - palacios_spinlock_lock_irqsave(&(dev->lock),f); if (palacios_host_dev_rendezvous(dev)) { - palacios_spinlock_unlock_irqrestore(&(dev->lock),f); + //palacios_spinlock_unlock_irqrestore(&(dev->lock),f); ERROR("palacios: ignoring request as user side is not connected (and did not rendezvous) for host device \"%s\"\n",dev->url); return 0; } + palacios_spinlock_lock_irqsave(&(dev->lock),f); + if (dev->waiting) { palacios_spinlock_unlock_irqrestore(&(dev->lock),f); ERROR("palacios: guest issued memory write request with host device \"%s\" in wrong state (waiting=%d, connected=%d)\n",dev->url,dev->waiting,dev->connected); @@ -1230,13 +1242,13 @@ static uint64_t palacios_host_dev_write_conf(v3_host_dev_t hostdev, DEEP_DEBUG_PRINT("palacios: hostdev: write conf 0x%p\n",(void*)offset); - palacios_spinlock_lock_irqsave(&(dev->lock),f); if (palacios_host_dev_rendezvous(dev)) { - palacios_spinlock_unlock_irqrestore(&(dev->lock),f); + //palacios_spinlock_unlock_irqrestore(&(dev->lock),f); ERROR("palacios: ignoring request as user side is not connected (and did not rendezvous) for host device \"%s\"\n",dev->url); return 0; } + palacios_spinlock_lock_irqsave(&(dev->lock),f); if (dev->waiting) { palacios_spinlock_unlock_irqrestore(&(dev->lock),f);