diff options
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/balloon.c | 6 | ||||
-rw-r--r-- | drivers/xen/events/events_base.c | 4 | ||||
-rw-r--r-- | drivers/xen/gntalloc.c | 9 | ||||
-rw-r--r-- | drivers/xen/gntdev.c | 2 | ||||
-rw-r--r-- | drivers/xen/platform-pci.c | 6 | ||||
-rw-r--r-- | drivers/xen/privcmd.c | 2 | ||||
-rw-r--r-- | drivers/xen/swiotlb-xen.c | 27 | ||||
-rw-r--r-- | drivers/xen/xen-pciback/xenbus.c | 8 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_dev_frontend.c | 2 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.c | 4 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe_backend.c | 8 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_xs.c | 22 |
12 files changed, 50 insertions, 50 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index e4db19e88ab1..db107fa50ca1 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -180,7 +180,6 @@ static void __balloon_append(struct page *page) static void balloon_append(struct page *page) { __balloon_append(page); - adjust_managed_page_count(page, -1); } /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */ @@ -201,8 +200,6 @@ static struct page *balloon_retrieve(bool require_lowmem) else balloon_stats.balloon_low--; - adjust_managed_page_count(page, 1); - return page; } @@ -478,7 +475,7 @@ static enum bp_state increase_reservation(unsigned long nr_pages) #endif /* Relinquish the page back to the allocator. */ - __free_reserved_page(page); + free_reserved_page(page); } balloon_stats.current_pages += rc; @@ -509,6 +506,7 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) state = BP_EAGAIN; break; } + adjust_managed_page_count(page, -1); scrub_page(page); list_add(&page->lru, &pages); } diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c index 9ecfcdcdd6d6..fd8e872d2943 100644 --- a/drivers/xen/events/events_base.c +++ b/drivers/xen/events/events_base.c @@ -37,7 +37,6 @@ #include <asm/desc.h> #include <asm/ptrace.h> #include <asm/irq.h> -#include <asm/idle.h> #include <asm/io_apic.h> #include <asm/i8259.h> #include <asm/xen/pci.h> @@ -948,7 +947,7 @@ static int find_virq(unsigned int virq, unsigned int cpu) continue; if (status.status != EVTCHNSTAT_virq) continue; - if (status.u.virq == virq && status.vcpu == cpu) { + if (status.u.virq == virq && status.vcpu == xen_vcpu_nr(cpu)) { rc = port; break; } @@ -1256,7 +1255,6 @@ void xen_evtchn_do_upcall(struct pt_regs *regs) irq_enter(); #ifdef CONFIG_X86 - exit_idle(); inc_irq_stat(irq_hv_callback_count); #endif diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c index 7a47c4c9fb1b..1bf55a32a4b3 100644 --- a/drivers/xen/gntalloc.c +++ b/drivers/xen/gntalloc.c @@ -127,18 +127,21 @@ static int add_grefs(struct ioctl_gntalloc_alloc_gref *op, struct gntalloc_gref *gref, *next; readonly = !(op->flags & GNTALLOC_FLAG_WRITABLE); - rc = -ENOMEM; for (i = 0; i < op->count; i++) { gref = kzalloc(sizeof(*gref), GFP_KERNEL); - if (!gref) + if (!gref) { + rc = -ENOMEM; goto undo; + } list_add_tail(&gref->next_gref, &queue_gref); list_add_tail(&gref->next_file, &queue_file); gref->users = 1; gref->file_index = op->index + i * PAGE_SIZE; gref->page = alloc_page(GFP_KERNEL|__GFP_ZERO); - if (!gref->page) + if (!gref->page) { + rc = -ENOMEM; goto undo; + } /* Grant foreign access to the page. */ rc = gnttab_grant_foreign_access(op->domid, diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index bb952121ea94..2ef2b61b69df 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -1007,7 +1007,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) vma->vm_ops = &gntdev_vmops; - vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP | VM_IO; + vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP | VM_MIXEDMAP; if (use_ptemod) vma->vm_flags |= VM_DONTCOPY; diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c index b59c9455aae1..112ce422dc22 100644 --- a/drivers/xen/platform-pci.c +++ b/drivers/xen/platform-pci.c @@ -125,8 +125,4 @@ static struct pci_driver platform_driver = { .id_table = platform_pci_tbl, }; -static int __init platform_pci_init(void) -{ - return pci_register_driver(&platform_driver); -} -device_initcall(platform_pci_init); +builtin_pci_driver(platform_driver); diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index 702040fe2001..6e3306f4a525 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -602,7 +602,7 @@ static int privcmd_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { printk(KERN_DEBUG "privcmd_fault: vma=%p %lx-%lx, pgoff=%lx, uv=%p\n", vma, vma->vm_start, vma->vm_end, - vmf->pgoff, vmf->virtual_address); + vmf->pgoff, (void *)vmf->address); return VM_FAULT_SIGBUS; } diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 87e6035c9e81..478fb91e3df2 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c @@ -405,7 +405,8 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, */ trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force); - map = swiotlb_tbl_map_single(dev, start_dma_addr, phys, size, dir); + map = swiotlb_tbl_map_single(dev, start_dma_addr, phys, size, dir, + attrs); if (map == SWIOTLB_MAP_ERROR) return DMA_ERROR_CODE; @@ -416,11 +417,13 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, /* * Ensure that the address returned is DMA'ble */ - if (!dma_capable(dev, dev_addr, size)) { - swiotlb_tbl_unmap_single(dev, map, size, dir); - dev_addr = 0; - } - return dev_addr; + if (dma_capable(dev, dev_addr, size)) + return dev_addr; + + attrs |= DMA_ATTR_SKIP_CPU_SYNC; + swiotlb_tbl_unmap_single(dev, map, size, dir, attrs); + + return DMA_ERROR_CODE; } EXPORT_SYMBOL_GPL(xen_swiotlb_map_page); @@ -444,7 +447,7 @@ static void xen_unmap_single(struct device *hwdev, dma_addr_t dev_addr, /* NOTE: We use dev_addr here, not paddr! */ if (is_xen_swiotlb_buffer(dev_addr)) { - swiotlb_tbl_unmap_single(hwdev, paddr, size, dir); + swiotlb_tbl_unmap_single(hwdev, paddr, size, dir, attrs); return; } @@ -557,11 +560,12 @@ xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, start_dma_addr, sg_phys(sg), sg->length, - dir); + dir, attrs); if (map == SWIOTLB_MAP_ERROR) { dev_warn(hwdev, "swiotlb buffer is full\n"); /* Don't panic here, we expect map_sg users to do proper error handling. */ + attrs |= DMA_ATTR_SKIP_CPU_SYNC; xen_swiotlb_unmap_sg_attrs(hwdev, sgl, i, dir, attrs); sg_dma_len(sgl) = 0; @@ -648,13 +652,6 @@ xen_swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, } EXPORT_SYMBOL_GPL(xen_swiotlb_sync_sg_for_device); -int -xen_swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr) -{ - return !dma_addr; -} -EXPORT_SYMBOL_GPL(xen_swiotlb_dma_mapping_error); - /* * Return whether the given device DMA address mask can be supported * properly. For example, if your device can only drive the low 24-bits diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c index 5ce878c51d03..3f0aee0a068b 100644 --- a/drivers/xen/xen-pciback/xenbus.c +++ b/drivers/xen/xen-pciback/xenbus.c @@ -362,7 +362,7 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev) int err = 0; int num_devs; int domain, bus, slot, func; - int substate; + unsigned int substate; int i, len; char state_str[64]; char dev_str[64]; @@ -395,10 +395,8 @@ static int xen_pcibk_reconfigure(struct xen_pcibk_device *pdev) "configuration"); goto out; } - err = xenbus_scanf(XBT_NIL, pdev->xdev->nodename, state_str, - "%d", &substate); - if (err != 1) - substate = XenbusStateUnknown; + substate = xenbus_read_unsigned(pdev->xdev->nodename, state_str, + XenbusStateUnknown); switch (substate) { case XenbusStateInitialising: diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index 1e8be12ebb55..6c0ead4be784 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c @@ -538,6 +538,8 @@ static int xenbus_file_open(struct inode *inode, struct file *filp) nonseekable_open(inode, filp); + filp->f_mode &= ~FMODE_ATOMIC_POS; /* cdev-style semantics */ + u = kzalloc(sizeof(*u), GFP_KERNEL); if (u == NULL) return -ENOMEM; diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 33a31cfef55d..4bdf654041e9 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -702,7 +702,7 @@ device_initcall(xenbus_probe_initcall); */ static int __init xenstored_local_init(void) { - int err = 0; + int err = -ENOMEM; unsigned long page = 0; struct evtchn_alloc_unbound alloc_unbound; @@ -826,7 +826,7 @@ static int __init xenbus_init(void) * Create xenfs mountpoint in /proc for compatibility with * utilities that expect to find "xenbus" under "/proc/xen". */ - proc_mkdir("xen", NULL); + proc_create_mount_point("xen"); #endif out_error: diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c index 04f7f85a5edf..37929df829a3 100644 --- a/drivers/xen/xenbus/xenbus_probe_backend.c +++ b/drivers/xen/xenbus/xenbus_probe_backend.c @@ -224,13 +224,7 @@ static int read_frontend_details(struct xenbus_device *xendev) int xenbus_dev_is_online(struct xenbus_device *dev) { - int rc, val; - - rc = xenbus_scanf(XBT_NIL, dev->nodename, "online", "%d", &val); - if (rc != 1) - val = 0; /* no online node present */ - - return val; + return !!xenbus_read_unsigned(dev->nodename, "online", 0); } EXPORT_SYMBOL_GPL(xenbus_dev_is_online); diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index 22f7cd711c57..6afb993c5809 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c @@ -559,6 +559,21 @@ int xenbus_scanf(struct xenbus_transaction t, } EXPORT_SYMBOL_GPL(xenbus_scanf); +/* Read an (optional) unsigned value. */ +unsigned int xenbus_read_unsigned(const char *dir, const char *node, + unsigned int default_val) +{ + unsigned int val; + int ret; + + ret = xenbus_scanf(XBT_NIL, dir, node, "%u", &val); + if (ret <= 0) + val = default_val; + + return val; +} +EXPORT_SYMBOL_GPL(xenbus_read_unsigned); + /* Single printf and write: returns -errno or 0. */ int xenbus_printf(struct xenbus_transaction t, const char *dir, const char *node, const char *fmt, ...) @@ -672,7 +687,7 @@ static bool xen_strict_xenbus_quirk(void) } static void xs_reset_watches(void) { - int err, supported = 0; + int err; if (!xen_hvm_domain() || xen_initial_domain()) return; @@ -680,9 +695,8 @@ static void xs_reset_watches(void) if (xen_strict_xenbus_quirk()) return; - err = xenbus_scanf(XBT_NIL, "control", - "platform-feature-xs_reset_watches", "%d", &supported); - if (err != 1 || !supported) + if (!xenbus_read_unsigned("control", + "platform-feature-xs_reset_watches", 0)) return; err = xs_error(xs_single(XBT_NIL, XS_RESET_WATCHES, "", NULL)); |