Displaying 20 results from an estimated 123 matches for "alloc_pages_exact".
2014 Sep 17
4
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...@ 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,
> + GFP_KERNEL);
> + } else {
> + info->que...
2014 Sep 17
4
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...@ 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,
> + GFP_KERNEL);
> + } else {
> + info->que...
2014 Sep 17
1
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...@ 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,
> + GFP_KERNEL);
> + } else {
> + info->que...
2014 Sep 17
1
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...@ 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,
> + GFP_KERNEL);
> + } else {
> + info->que...
2014 Aug 27
2
[PATCH 3/3] virtio_pci: Use the DMA API for virtqueues
...> 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);
> if (info->queue == NULL) {
> err = -ENOMEM;
> goto out_info;
>...
2014 Aug 27
2
[PATCH 3/3] virtio_pci: Use the DMA API for virtqueues
...> 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);
> if (info->queue == NULL) {
> err = -ENOMEM;
> goto out_info;
>...
2018 Jul 30
1
[RFC 1/4] virtio: Define virtio_direct_dma_ops structure
...gt; +
> +int virtio_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 Oct 25
0
[RFC PATCH 1/2] Add a new register offset let interrupt reason available
...*pdev)
struct virtio_mmio_device *vm_dev;
struct resource *mem;
unsigned long magic;
+ int err;
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem)
@@ -481,6 +484,15 @@ static int virtio_mmio_probe(struct platform_device *pdev)
return -ENXIO;
}
+ vm_dev->isr_mem = alloc_pages_exact(PAGE_SIZE, GFP_KERNEL|__GFP_ZERO);
+ if (vm_dev->isr_mem == NULL) {
+ dev_err(&pdev->dev, "Allocate isr memory failed!\n");
+ return -ENOMEM;
+ }
+
+ writel(virt_to_phys(vm_dev->isr_mem),
+ vm_dev->base + VIRTIO_MMIO_ISRMEM);
+
vm_dev->vdev.id.device = readl(...
2014 Sep 17
0
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...st 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,
+ GFP_KERNEL);
+ } else {
+ info->queue = alloc_pages_exact(PAGE_ALIGN(s...
2014 Sep 17
0
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...irtio_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...
2017 Sep 25
0
[PATCH v1 1/4] KVM/vmx: re-write the msr auto switch feature
...u;
if (!vmx)
return ERR_PTR(-ENOMEM);
@@ -9559,6 +9598,17 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
goto free_msrs;
loaded_vmcs_init(vmx->loaded_vmcs);
+ bytes = msr_autoload_count_max * sizeof(struct vmx_msr_entry);
+ vmx->msr_autoload.guest = alloc_pages_exact(bytes,
+ GFP_KERNEL | __GFP_ZERO);
+ if (!vmx->msr_autoload.guest)
+ goto free_vmcs;
+
+ vmx->msr_autoload.host = alloc_pages_exact(bytes,
+ GFP_KERNEL | __GFP_ZERO);
+ if (!vmx->msr_autoload.guest)
+ goto free_autoload_guest;
+
cpu = get_cpu();
vmx_vcpu_load(&vm...
2014 Sep 17
0
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...(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,
> > + GFP_KERNEL);
> > +...
2019 Apr 08
1
[RFC PATCH 01/12] virtio/s390: use vring_create_virtqueue
...+ b/drivers/s390/virtio/virtio_ccw.c
> @@ -516,17 +512,10 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
> err = info->num;
> goto out_err;
> }
> - size = PAGE_ALIGN(vring_size(info->num, KVM_VIRTIO_CCW_RING_ALIGN));
> - info->queue = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);
> - if (info->queue == NULL) {
> - dev_warn(&vcdev->cdev->dev, "no queue\n");
> - err = -ENOMEM;
> - goto out_err;
> - }
> + vq = vring_create_virtqueue(i, info->num, KVM_VIRTIO_CCW_RING_ALIGN,
> + vdev, true,...
2015 Dec 07
6
[PATCH RFC 0/3] Xen on Virtio
Hi all,
this patch series introduces support for running Linux on top of Xen
inside a virtual machine with virtio devices (nested virt scenario).
The problem is that Linux virtio drivers use virt_to_phys to get the
guest pseudo-physical addresses to pass to the backend, which doesn't
work as expected on Xen.
Switching the virtio drivers to the dma APIs (dma_alloc_coherent,
2015 Dec 07
6
[PATCH RFC 0/3] Xen on Virtio
Hi all,
this patch series introduces support for running Linux on top of Xen
inside a virtual machine with virtio devices (nested virt scenario).
The problem is that Linux virtio drivers use virt_to_phys to get the
guest pseudo-physical addresses to pass to the backend, which doesn't
work as expected on Xen.
Switching the virtio drivers to the dma APIs (dma_alloc_coherent,
2020 Jun 25
5
[RFC 0/3] virtio: NUMA-aware memory allocation
These patches are not ready to be merged because I was unable to measure a
performance improvement. I'm publishing them so they are archived in case
someone picks up this work again in the future.
The goal of these patches is to allocate virtqueues and driver state from the
device's NUMA node for optimal memory access latency. Only guests with a vNUMA
topology and virtio devices spread
2020 Jun 25
5
[RFC 0/3] virtio: NUMA-aware memory allocation
These patches are not ready to be merged because I was unable to measure a
performance improvement. I'm publishing them so they are archived in case
someone picks up this work again in the future.
The goal of these patches is to allocate virtqueues and driver state from the
device's NUMA node for optimal memory access latency. Only guests with a vNUMA
topology and virtio devices spread
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,
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,
2015 Sep 10
0
[PATCH 1/1] virtio/s390: handle failures of READ_VQ_CONF ccw
...tqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
goto out_err;
}
info->num = virtio_ccw_read_vq_conf(vcdev, ccw, i);
+ if (info->num < 0) {
+ err = info->num;
+ goto out_err;
+ }
size = PAGE_ALIGN(vring_size(info->num, KVM_VIRTIO_CCW_RING_ALIGN));
info->queue = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);
if (info->queue == NULL) {
--
2.3.8