Displaying 20 results from an estimated 416 matches for "page_align".
2018 Jul 30
1
[RFC 1/4] virtio: Define virtio_direct_dma_ops structure
...rtio_direct_mapping_error(struct device *hwdev, dma_addr_t dma_addr)
> +{
> + return 0;
> +}
Including this one.
> +void *virtio_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
> + gfp_t gfp, unsigned long attrs)
> +{
> + void *queue = alloc_pages_exact(PAGE_ALIGN(size), gfp);
> +
> + if (queue) {
> + phys_addr_t phys_addr = virt_to_phys(queue);
> + *dma_handle = (dma_addr_t)phys_addr;
> +
> + if (WARN_ON_ONCE(*dma_handle != phys_addr)) {
> + free_pages_exact(queue, PAGE_ALIGN(size));
> + return NULL;
> + }
> + }
> +...
2014 Sep 17
4
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...truct virtqueue *vq),
> const char *name,
> @@ -416,21 +462,30 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
>
> info->num = num;
> info->msix_vector = msix_vec;
> + info->use_dma_api = vp_use_dma_api();
>
> - size = PAGE_ALIGN(vring_size(num, VIRTIO_PCI_VRING_ALIGN));
> - info->queue = alloc_pages_exact(size, GFP_KERNEL|__GFP_ZERO);
> + size = vring_size(num, VIRTIO_PCI_VRING_ALIGN);
> + if (info->use_dma_api) {
> + info->queue = dma_zalloc_coherent(vdev->dev.parent, size,
> + &info...
2014 Sep 17
4
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...truct virtqueue *vq),
> const char *name,
> @@ -416,21 +462,30 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
>
> info->num = num;
> info->msix_vector = msix_vec;
> + info->use_dma_api = vp_use_dma_api();
>
> - size = PAGE_ALIGN(vring_size(num, VIRTIO_PCI_VRING_ALIGN));
> - info->queue = alloc_pages_exact(size, GFP_KERNEL|__GFP_ZERO);
> + size = vring_size(num, VIRTIO_PCI_VRING_ALIGN);
> + if (info->use_dma_api) {
> + info->queue = dma_zalloc_coherent(vdev->dev.parent, size,
> + &info...
2014 Sep 17
1
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...truct virtqueue *vq),
> const char *name,
> @@ -416,21 +462,30 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
>
> info->num = num;
> info->msix_vector = msix_vec;
> + info->use_dma_api = vp_use_dma_api();
>
> - size = PAGE_ALIGN(vring_size(num, VIRTIO_PCI_VRING_ALIGN));
> - info->queue = alloc_pages_exact(size, GFP_KERNEL|__GFP_ZERO);
> + size = vring_size(num, VIRTIO_PCI_VRING_ALIGN);
> + if (info->use_dma_api) {
> + info->queue = dma_zalloc_coherent(vdev->dev.parent, size,
> + &info...
2014 Sep 17
1
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...truct virtqueue *vq),
> const char *name,
> @@ -416,21 +462,30 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
>
> info->num = num;
> info->msix_vector = msix_vec;
> + info->use_dma_api = vp_use_dma_api();
>
> - size = PAGE_ALIGN(vring_size(num, VIRTIO_PCI_VRING_ALIGN));
> - info->queue = alloc_pages_exact(size, GFP_KERNEL|__GFP_ZERO);
> + size = vring_size(num, VIRTIO_PCI_VRING_ALIGN);
> + if (info->use_dma_api) {
> + info->queue = dma_zalloc_coherent(vdev->dev.parent, size,
> + &info...
2013 Jan 24
1
[PATCH 35/35] x86: Don't panic if can not alloc buffer for swiotlb
...(char *tlb, unsigned long nslabs, int verbose)
{
void *v_overflow_buffer;
unsigned long i, bytes;
@@ -150,9 +157,10 @@ void __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose)
/*
* Get the overflow emergency buffer
*/
- v_overflow_buffer = alloc_bootmem_low_pages(PAGE_ALIGN(io_tlb_overflow));
+ v_overflow_buffer = alloc_bootmem_low_pages_nopanic(
+ PAGE_ALIGN(io_tlb_overflow));
if (!v_overflow_buffer)
- panic("Cannot allocate SWIOTLB overflow buffer!\n");
+ return -ENOMEM;
io_tlb_overflow_buffer = __pa(v_overflow_buffer);
@@ -169,15 +177,19 @@...
2013 Jan 24
1
[PATCH 35/35] x86: Don't panic if can not alloc buffer for swiotlb
...(char *tlb, unsigned long nslabs, int verbose)
{
void *v_overflow_buffer;
unsigned long i, bytes;
@@ -150,9 +157,10 @@ void __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose)
/*
* Get the overflow emergency buffer
*/
- v_overflow_buffer = alloc_bootmem_low_pages(PAGE_ALIGN(io_tlb_overflow));
+ v_overflow_buffer = alloc_bootmem_low_pages_nopanic(
+ PAGE_ALIGN(io_tlb_overflow));
if (!v_overflow_buffer)
- panic("Cannot allocate SWIOTLB overflow buffer!\n");
+ return -ENOMEM;
io_tlb_overflow_buffer = __pa(v_overflow_buffer);
@@ -169,15 +177,19 @@...
2007 Nov 14
1
[PATCH] Remove pagesize parameter from vring_init/vring_size
The PAGE_SIZE constant should be used instead of taking an extra parameter.
Moreover, once we use PAGE_SIZE, we can use PAGE_ALIGN() instead of having it
open coded.
I've only compile tested the lguest launcher as I'm on a 64-bit system but I've
tested the virtio-pci device with KVM.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lgues...
2007 Nov 14
1
[PATCH] Remove pagesize parameter from vring_init/vring_size
The PAGE_SIZE constant should be used instead of taking an extra parameter.
Moreover, once we use PAGE_SIZE, we can use PAGE_ALIGN() instead of having it
open coded.
I've only compile tested the lguest launcher as I'm on a 64-bit system but I've
tested the virtio-pci device with KVM.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lgues...
2014 Sep 17
0
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...nsigned index,
void (*callback)(struct virtqueue *vq),
const char *name,
@@ -416,21 +462,30 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
info->num = num;
info->msix_vector = msix_vec;
+ info->use_dma_api = vp_use_dma_api();
- size = PAGE_ALIGN(vring_size(num, VIRTIO_PCI_VRING_ALIGN));
- info->queue = alloc_pages_exact(size, GFP_KERNEL|__GFP_ZERO);
+ size = vring_size(num, VIRTIO_PCI_VRING_ALIGN);
+ if (info->use_dma_api) {
+ info->queue = dma_zalloc_coherent(vdev->dev.parent, size,
+ &info->queue_dma_addr,
+...
2014 Sep 17
0
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...char *name,
>> @@ -416,21 +462,30 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
>>
>> info->num = num;
>> info->msix_vector = msix_vec;
>> + info->use_dma_api = vp_use_dma_api();
>>
>> - size = PAGE_ALIGN(vring_size(num, VIRTIO_PCI_VRING_ALIGN));
>> - info->queue = alloc_pages_exact(size, GFP_KERNEL|__GFP_ZERO);
>> + size = vring_size(num, VIRTIO_PCI_VRING_ALIGN);
>> + if (info->use_dma_api) {
>> + info->queue = dma_zalloc_coherent(vdev->de...
2014 Aug 27
2
[PATCH 3/3] virtio_pci: Use the DMA API for virtqueues
.../* bus address */
>
> /* the list node for the virtqueues list */
> struct list_head node;
> @@ -417,15 +418,16 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
> info->num = num;
> info->msix_vector = msix_vec;
>
> - size = PAGE_ALIGN(vring_size(num, VIRTIO_PCI_VRING_ALIGN));
> - info->queue = alloc_pages_exact(size, GFP_KERNEL|__GFP_ZERO);
> + size = vring_size(num, VIRTIO_PCI_VRING_ALIGN);
> + info->queue = dma_zalloc_coherent(vdev->dev.parent, size,
> + &info->queue_dma_addr, GFP_KERNEL);
>...
2014 Aug 27
2
[PATCH 3/3] virtio_pci: Use the DMA API for virtqueues
.../* bus address */
>
> /* the list node for the virtqueues list */
> struct list_head node;
> @@ -417,15 +418,16 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
> info->num = num;
> info->msix_vector = msix_vec;
>
> - size = PAGE_ALIGN(vring_size(num, VIRTIO_PCI_VRING_ALIGN));
> - info->queue = alloc_pages_exact(size, GFP_KERNEL|__GFP_ZERO);
> + size = vring_size(num, VIRTIO_PCI_VRING_ALIGN);
> + info->queue = dma_zalloc_coherent(vdev->dev.parent, size,
> + &info->queue_dma_addr, GFP_KERNEL);
>...
2014 Sep 17
0
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...onst char *name,
> > @@ -416,21 +462,30 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
> >
> > info->num = num;
> > info->msix_vector = msix_vec;
> > + info->use_dma_api = vp_use_dma_api();
> >
> > - size = PAGE_ALIGN(vring_size(num, VIRTIO_PCI_VRING_ALIGN));
> > - info->queue = alloc_pages_exact(size, GFP_KERNEL|__GFP_ZERO);
> > + size = vring_size(num, VIRTIO_PCI_VRING_ALIGN);
> > + if (info->use_dma_api) {
> > + info->queue = dma_zalloc_coherent(vdev->dev.parent, size,
>...
2007 Aug 19
4
[PATCH] Xen i386 xen-head.S fix sections mixup
...ng.orig/arch/i386/xen/xen-head.S 2007-08-19 22:45:58.000000000 -0400
+++ linux-2.6-lttng/arch/i386/xen/xen-head.S 2007-08-19 22:46:19.000000000 -0400
@@ -13,6 +13,7 @@ ENTRY(startup_xen)
cld
movl $(init_thread_union+THREAD_SIZE),%esp
jmp xen_start_kernel
+ .previous
.pushsection ".bss.page_aligned"
.align PAGE_SIZE_asm
@@ -34,5 +35,6 @@ ENTRY(hypercall_page)
ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "no")
#endif
ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic")
+ .previous
#endif /*CONFIG_XEN */
--
Mathieu Desnoyers
Computer Engineering P...
2007 Aug 19
4
[PATCH] Xen i386 xen-head.S fix sections mixup
...ng.orig/arch/i386/xen/xen-head.S 2007-08-19 22:45:58.000000000 -0400
+++ linux-2.6-lttng/arch/i386/xen/xen-head.S 2007-08-19 22:46:19.000000000 -0400
@@ -13,6 +13,7 @@ ENTRY(startup_xen)
cld
movl $(init_thread_union+THREAD_SIZE),%esp
jmp xen_start_kernel
+ .previous
.pushsection ".bss.page_aligned"
.align PAGE_SIZE_asm
@@ -34,5 +35,6 @@ ENTRY(hypercall_page)
ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "no")
#endif
ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic")
+ .previous
#endif /*CONFIG_XEN */
--
Mathieu Desnoyers
Computer Engineering P...
2007 Aug 19
4
[PATCH] Xen i386 xen-head.S fix sections mixup
...ng.orig/arch/i386/xen/xen-head.S 2007-08-19 22:45:58.000000000 -0400
+++ linux-2.6-lttng/arch/i386/xen/xen-head.S 2007-08-19 22:46:19.000000000 -0400
@@ -13,6 +13,7 @@ ENTRY(startup_xen)
cld
movl $(init_thread_union+THREAD_SIZE),%esp
jmp xen_start_kernel
+ .previous
.pushsection ".bss.page_aligned"
.align PAGE_SIZE_asm
@@ -34,5 +35,6 @@ ENTRY(hypercall_page)
ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz "no")
#endif
ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic")
+ .previous
#endif /*CONFIG_XEN */
--
Mathieu Desnoyers
Computer Engineering P...
2020 Sep 01
4
[PATCH 1/3] drm/ttm: make sure that we always zero init mem.bus v2
...false;
evict_mem.bus.io_reserved_count = 0;
+ evict_mem.bus.base = 0;
+ evict_mem.bus.offset = 0;
+ evict_mem.bus.addr = NULL;
ret = ttm_bo_mem_space(bo, &placement, &evict_mem, ctx);
if (ret) {
@@ -1084,6 +1087,9 @@ static int ttm_bo_move_buffer(struct ttm_buffer_object *bo,
mem.page_alignment = bo->mem.page_alignment;
mem.bus.io_reserved_vm = false;
mem.bus.io_reserved_count = 0;
+ mem.bus.base = 0;
+ mem.bus.offset = 0;
+ mem.bus.addr = NULL;
mem.mm_node = NULL;
/*
@@ -1243,6 +1249,9 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
bo->mem.page_alignment =...
2018 Jul 20
0
[RFC 1/4] virtio: Define virtio_direct_dma_ops structure
...direction dir,
+ unsigned long attrs)
+{
+}
+
+int virtio_direct_mapping_error(struct device *hwdev, dma_addr_t dma_addr)
+{
+ return 0;
+}
+
+void *virtio_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+ gfp_t gfp, unsigned long attrs)
+{
+ void *queue = alloc_pages_exact(PAGE_ALIGN(size), gfp);
+
+ if (queue) {
+ phys_addr_t phys_addr = virt_to_phys(queue);
+ *dma_handle = (dma_addr_t)phys_addr;
+
+ if (WARN_ON_ONCE(*dma_handle != phys_addr)) {
+ free_pages_exact(queue, PAGE_ALIGN(size));
+ return NULL;
+ }
+ }
+ return queue;
+}
+
+void virtio_direct_free(struct devi...
2014 Sep 17
6
[PATCH v5 0/3] virtio: Use the DMA API when appropriate
This fixes virtio on Xen guests as well as on any other platform
that uses virtio_pci on which physical addresses don't match bus
addresses.
This can be tested with:
virtme-run --xen xen --kimg arch/x86/boot/bzImage --console
using virtme from here:
https://git.kernel.org/cgit/utils/kernel/virtme/virtme.git
Without these patches, the guest hangs forever. With these patches,