search for: get_order

Displaying 20 results from an estimated 160 matches for "get_order".

2011 Feb 11
1
[PATCH 1/3]: Staging: hv: Use native page allocation/free functions
...vmbus_channel *newchannel, u32 send_ringbuffer_size, newchannel->channel_callback_context = context; /* Allocate the ring buffer */ - out = osd_page_alloc((send_ringbuffer_size + recv_ringbuffer_size) - >> PAGE_SHIFT); + out = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, + get_order(send_ringbuffer_size + recv_ringbuffer_size)); + if (!out) return -ENOMEM; @@ -300,8 +301,8 @@ Cleanup: errorout: ringbuffer_cleanup(&newchannel->outbound); ringbuffer_cleanup(&newchannel->inbound); - osd_page_free(out, (send_ringbuffer_size + recv_ringbuffer_size) -...
2011 Feb 11
1
[PATCH 1/3]: Staging: hv: Use native page allocation/free functions
...vmbus_channel *newchannel, u32 send_ringbuffer_size, newchannel->channel_callback_context = context; /* Allocate the ring buffer */ - out = osd_page_alloc((send_ringbuffer_size + recv_ringbuffer_size) - >> PAGE_SHIFT); + out = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, + get_order(send_ringbuffer_size + recv_ringbuffer_size)); + if (!out) return -ENOMEM; @@ -300,8 +301,8 @@ Cleanup: errorout: ringbuffer_cleanup(&newchannel->outbound); ringbuffer_cleanup(&newchannel->inbound); - osd_page_free(out, (send_ringbuffer_size + recv_ringbuffer_size) -...
2013 Sep 06
0
[PATCH RESEND v3 0/7] Enable Drivers for Intel MIC X100 Coprocessors.
...9 @@ static void mic_notify(struct virtqueue *vq) static void mic_del_vq(struct virtqueue *vq, int n) { struct mic_vdev *mvdev = to_micvdev(vq->vdev); - struct vring *vr = (struct vring *) (vq + 1); + struct vring *vr = (struct vring *)(vq + 1); - free_pages((unsigned long) vr->used, - get_order(mvdev->used_size[n])); + free_pages((unsigned long) vr->used, get_order(mvdev->used_size[n])); vring_del_virtqueue(vq); mic_card_unmap(mvdev->mdev, mvdev->vr[n]); mvdev->vr[n] = NULL; @@ -274,8 +273,8 @@ static struct virtqueue *mic_find_vq(struct virtio_device *vdev, /* A...
2020 Aug 19
0
[PATCH 10/28] MIPS/jazzdma: decouple from dma-direct
...- if (!ret) - return NULL; + if (attrs & DMA_ATTR_NO_WARN) + gfp |= __GFP_NOWARN; - *dma_handle = vdma_alloc(virt_to_phys(ret), size); - if (*dma_handle == DMA_MAPPING_ERROR) { - dma_direct_free_pages(dev, size, ret, *dma_handle, attrs); + size = PAGE_ALIGN(size); + page = alloc_pages(gfp, get_order(size)); + if (!page) return NULL; - } + ret = page_address(page); + *dma_handle = vdma_alloc(virt_to_phys(ret), size); + if (*dma_handle == DMA_MAPPING_ERROR) + goto out_free_pages; + + if (attrs & DMA_ATTR_NON_CONSISTENT) + return ret; + arch_dma_prep_coherent(page, size); + return (void...
2008 Apr 25
5
Best way to pass ID variable to partials - global var??
I have several orders that are being updated in an internal data entry app. I start by going from an order to pop-up form that allows a user to select items to add to a field in the order. The pop-up form contains 2 partials for drag and drop functionality from AWD. The user starts by selecting a category in a drop down list. Then on select, the first partial is filled with the list of
2007 Nov 10
1
[PATCH] virtio_pci updates
...v, unsigned index, info->queue_index = index; info->num = num; - /* determine the memory needed for the queue and provide the memory - * location to the host */ - info->n_pages = DIV_ROUND_UP(vring_size(num), PAGE_SIZE); - info->pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, - get_order(info->n_pages)); - if (info->pages == NULL) { - err = -ENOMEM; - goto out_info; - } - - /* FIXME: is this sufficient for info->n_pages > 1? */ - info->queue = kmap(info->pages); + info->queue = kmalloc(vring_size(num), GFP_KERNEL | __GFP_ZERO); if (info->queue == NULL) {...
2007 Nov 10
1
[PATCH] virtio_pci updates
...v, unsigned index, info->queue_index = index; info->num = num; - /* determine the memory needed for the queue and provide the memory - * location to the host */ - info->n_pages = DIV_ROUND_UP(vring_size(num), PAGE_SIZE); - info->pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, - get_order(info->n_pages)); - if (info->pages == NULL) { - err = -ENOMEM; - goto out_info; - } - - /* FIXME: is this sufficient for info->n_pages > 1? */ - info->queue = kmap(info->pages); + info->queue = kmalloc(vring_size(num), GFP_KERNEL | __GFP_ZERO); if (info->queue == NULL) {...
2015 Nov 02
1
[PATCH 1/3] Provide simple noop dma ops
On Fri, Oct 30, 2015 at 02:20:35PM +0100, Christian Borntraeger wrote: > +static void *dma_noop_alloc(struct device *dev, size_t size, > + dma_addr_t *dma_handle, gfp_t gfp, > + struct dma_attrs *attrs) > +{ > + void *ret; > + > + ret = (void *)__get_free_pages(gfp, get_order(size)); > + if (ret) { > + memset(ret, 0, size); There is no need to zero out the memory here. If the user wants initialized memory it can call dma_zalloc_coherent. Having the memset here means to clear the memory twice in the dma_zalloc_coherent path. Otherwise it looks good. Joerg
2020 Jul 21
0
[PATCH v2] virtio_ring: use alloc_pages_node for NUMA-aware allocation
...t(vdev->dev.parent, size, > dma_handle, flag); > } else { > - void *queue = alloc_pages_exact(PAGE_ALIGN(size), flag); > - > - if (queue) { > + void *queue = NULL; > + struct page *page = alloc_pages_node(dev_to_node(vdev->dev.parent), > + flag, get_order(size)); > + if (page) { > + queue = page_address(page); > phys_addr_t phys_addr = virt_to_phys(queue); > *dma_handle = (dma_addr_t)phys_addr; > > @@ -308,7 +310,7 @@ static void vring_free_queue(struct virtio_device *vdev, size_t size, > if (vring_use_dma_api(vde...
2015 Nov 02
1
[PATCH 1/3] Provide simple noop dma ops
On Fri, Oct 30, 2015 at 02:20:35PM +0100, Christian Borntraeger wrote: > +static void *dma_noop_alloc(struct device *dev, size_t size, > + dma_addr_t *dma_handle, gfp_t gfp, > + struct dma_attrs *attrs) > +{ > + void *ret; > + > + ret = (void *)__get_free_pages(gfp, get_order(size)); > + if (ret) { > + memset(ret, 0, size); There is no need to zero out the memory here. If the user wants initialized memory it can call dma_zalloc_coherent. Having the memset here means to clear the memory twice in the dma_zalloc_coherent path. Otherwise it looks good. Joerg
2005 Apr 15
0
[PATCH] Eliminate kernel version checks from i386/kernel/pci-dma.c
...-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, - dma_addr_t *dma_handle) -#else void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, int gfp) -#endif { void *ret; unsigned int order = get_order(size); unsigned long vstart; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - int gfp = GFP_ATOMIC; - - if (hwdev == NULL || ((u32)hwdev->dma_mask < 0xffffffff)) - gfp |= GFP_DMA; -#else struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; /* ignore region specifiers */...
2015 Nov 03
0
[PATCH 1/3] dma: Provide simple noop dma ops
...#include <linux/mm.h> +#include <linux/dma-mapping.h> +#include <linux/scatterlist.h> + +static void *dma_noop_alloc(struct device *dev, size_t size, + dma_addr_t *dma_handle, gfp_t gfp, + struct dma_attrs *attrs) +{ + void *ret; + + ret = (void *)__get_free_pages(gfp, get_order(size)); + if (ret) + *dma_handle = virt_to_phys(ret); + return ret; +} + +static void dma_noop_free(struct device *dev, size_t size, + void *cpu_addr, dma_addr_t dma_addr, + struct dma_attrs *attrs) +{ + free_pages((unsigned long)cpu_addr, get_order(size)); +} + +static dma_addr_t dma_noop...
2015 Oct 30
0
[PATCH 1/3] Provide simple noop dma ops
...#include <linux/mm.h> +#include <linux/dma-mapping.h> +#include <linux/scatterlist.h> + +static void *dma_noop_alloc(struct device *dev, size_t size, + dma_addr_t *dma_handle, gfp_t gfp, + struct dma_attrs *attrs) +{ + void *ret; + + ret = (void *)__get_free_pages(gfp, get_order(size)); + if (ret) { + memset(ret, 0, size); + *dma_handle = virt_to_phys(ret); + } + return ret; +} + +static void dma_noop_free(struct device *dev, size_t size, + void *cpu_addr, dma_addr_t dma_addr, + struct dma_attrs *attrs) +{ + free_pages((unsigned long)cpu_addr, get_order(size)); +...
2015 Nov 05
0
[GIT PULL v4 1/3] dma: Provide simple noop dma ops
...#include <linux/mm.h> +#include <linux/dma-mapping.h> +#include <linux/scatterlist.h> + +static void *dma_noop_alloc(struct device *dev, size_t size, + dma_addr_t *dma_handle, gfp_t gfp, + struct dma_attrs *attrs) +{ + void *ret; + + ret = (void *)__get_free_pages(gfp, get_order(size)); + if (ret) + *dma_handle = virt_to_phys(ret); + return ret; +} + +static void dma_noop_free(struct device *dev, size_t size, + void *cpu_addr, dma_addr_t dma_addr, + struct dma_attrs *attrs) +{ + free_pages((unsigned long)cpu_addr, get_order(size)); +} + +static dma_addr_t dma_noop...
2016 Jun 02
0
[RFC v3 20/45] xen: dma-mapping: Use unsigned long for dma_attrs
...644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c @@ -294,7 +294,7 @@ error: void * xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, dma_addr_t *dma_handle, gfp_t flags, - struct dma_attrs *attrs) + unsigned long attrs) { void *ret; int order = get_order(size); @@ -346,7 +346,7 @@ EXPORT_SYMBOL_GPL(xen_swiotlb_alloc_coherent); void xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, - dma_addr_t dev_addr, struct dma_attrs *attrs) + dma_addr_t dev_addr, unsigned long attrs) { int order = get_order(size); phys_a...
2015 Oct 30
8
[PATCHv2 0/3] dma ops and virtio
here is the 2nd version of providing an DMA API for s390. There are some attempts to unify the dma ops (Christoph) as well as some attempts to make virtio use the dma API (Andy). At kernel summit we concluded that we want to use the same code on all platforms, whereever possible, so having a dummy dma_op might be the easiest solution to keep virtio-ccw as similar as possible to
2015 Oct 30
8
[PATCHv2 0/3] dma ops and virtio
here is the 2nd version of providing an DMA API for s390. There are some attempts to unify the dma ops (Christoph) as well as some attempts to make virtio use the dma API (Andy). At kernel summit we concluded that we want to use the same code on all platforms, whereever possible, so having a dummy dma_op might be the easiest solution to keep virtio-ccw as similar as possible to
2019 Dec 21
0
[PATCH 2/8] iommu/vt-d: Use default dma_direct_* mapping functions for direct mapped devices
...t(struct device *dev, size_t size, @@ -3617,9 +3589,6 @@ static void *intel_alloc_coherent(struct device *dev, size_t size, struct page *page = NULL; int order; - if (iommu_no_mapping(dev)) - return dma_direct_alloc(dev, size, dma_handle, flags, attrs); - size = PAGE_ALIGN(size); order = get_order(size); @@ -3653,9 +3622,6 @@ static void intel_free_coherent(struct device *dev, size_t size, void *vaddr, int order; struct page *page = virt_to_page(vaddr); - if (iommu_no_mapping(dev)) - return dma_direct_free(dev, size, vaddr, dma_handle, attrs); - size = PAGE_ALIGN(size); order =...
2011 May 25
0
[PATCH 1/1] staging: hv: remove netvsc send buffer and related functions
...rr(&net_device->dev->device, - "unable to teardown send buffer's gpadl"); - return -1; - } - net_device->send_buf_gpadl_handle = 0; - } - - if (net_device->send_buf) { - /* Free up the receive buffer */ - free_pages((unsigned long)net_device->send_buf, - get_order(net_device->send_buf_size)); - net_device->send_buf = NULL; - } - - return ret; -} - -static int netvsc_init_send_buf(struct hv_device *device) -{ - int ret = 0; - int t; - struct netvsc_device *net_device; - struct nvsp_message *init_packet; - - net_device = get_outbound_net_device(device);...
2011 May 25
0
[PATCH 1/1] staging: hv: remove netvsc send buffer and related functions
...rr(&net_device->dev->device, - "unable to teardown send buffer's gpadl"); - return -1; - } - net_device->send_buf_gpadl_handle = 0; - } - - if (net_device->send_buf) { - /* Free up the receive buffer */ - free_pages((unsigned long)net_device->send_buf, - get_order(net_device->send_buf_size)); - net_device->send_buf = NULL; - } - - return ret; -} - -static int netvsc_init_send_buf(struct hv_device *device) -{ - int ret = 0; - int t; - struct netvsc_device *net_device; - struct nvsp_message *init_packet; - - net_device = get_outbound_net_device(device);...