Displaying 20 results from an estimated 117 matches for "free_pages_exact".
2014 Sep 17
4
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...gt; + true, info->use_dma_api, info->queue,
> vp_notify, callback, name);
> if (!vq) {
> err = -ENOMEM;
> @@ -463,7 +518,12 @@ out_assign:
> vring_del_virtqueue(vq);
> out_activate_queue:
> iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
> - free_pages_exact(info->queue, size);
> + if (info->use_dma_api) {
> + dma_free_coherent(vdev->dev.parent, size,
> + info->queue, info->queue_dma_addr);
> + } else {
> + free_pages_exact(info->queue, PAGE_ALIGN(size));
> + }
> out_info:
> kfree(info);
> return...
2014 Sep 17
4
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...gt; + true, info->use_dma_api, info->queue,
> vp_notify, callback, name);
> if (!vq) {
> err = -ENOMEM;
> @@ -463,7 +518,12 @@ out_assign:
> vring_del_virtqueue(vq);
> out_activate_queue:
> iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
> - free_pages_exact(info->queue, size);
> + if (info->use_dma_api) {
> + dma_free_coherent(vdev->dev.parent, size,
> + info->queue, info->queue_dma_addr);
> + } else {
> + free_pages_exact(info->queue, PAGE_ALIGN(size));
> + }
> out_info:
> kfree(info);
> return...
2014 Sep 17
1
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...gt; + true, info->use_dma_api, info->queue,
> vp_notify, callback, name);
> if (!vq) {
> err = -ENOMEM;
> @@ -463,7 +518,12 @@ out_assign:
> vring_del_virtqueue(vq);
> out_activate_queue:
> iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
> - free_pages_exact(info->queue, size);
> + if (info->use_dma_api) {
> + dma_free_coherent(vdev->dev.parent, size,
> + info->queue, info->queue_dma_addr);
> + } else {
> + free_pages_exact(info->queue, PAGE_ALIGN(size));
> + }
> out_info:
> kfree(info);
> return...
2014 Sep 17
1
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...gt; + true, info->use_dma_api, info->queue,
> vp_notify, callback, name);
> if (!vq) {
> err = -ENOMEM;
> @@ -463,7 +518,12 @@ out_assign:
> vring_del_virtqueue(vq);
> out_activate_queue:
> iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
> - free_pages_exact(info->queue, size);
> + if (info->use_dma_api) {
> + dma_free_coherent(vdev->dev.parent, size,
> + info->queue, info->queue_dma_addr);
> + } else {
> + free_pages_exact(info->queue, PAGE_ALIGN(size));
> + }
> out_info:
> kfree(info);
> return...
2014 Aug 27
2
[PATCH 3/3] virtio_pci: Use the DMA API for virtqueues
...a_addr >> VIRTIO_PCI_QUEUE_ADDR_SHIFT,
> vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
>
> /* create the vring */
> @@ -462,7 +464,8 @@ out_assign:
> vring_del_virtqueue(vq);
> out_activate_queue:
> iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
> - free_pages_exact(info->queue, size);
> + dma_free_coherent(vdev->dev.parent, size,
> + info->queue, info->queue_dma_addr);
> out_info:
> kfree(info);
> return ERR_PTR(err);
> @@ -493,7 +496,8 @@ static void vp_del_vq(struct virtqueue *vq)
> iowrite32(0, vp_dev->ioaddr...
2014 Aug 27
2
[PATCH 3/3] virtio_pci: Use the DMA API for virtqueues
...a_addr >> VIRTIO_PCI_QUEUE_ADDR_SHIFT,
> vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
>
> /* create the vring */
> @@ -462,7 +464,8 @@ out_assign:
> vring_del_virtqueue(vq);
> out_activate_queue:
> iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
> - free_pages_exact(info->queue, size);
> + dma_free_coherent(vdev->dev.parent, size,
> + info->queue, info->queue_dma_addr);
> out_info:
> kfree(info);
> return ERR_PTR(err);
> @@ -493,7 +496,8 @@ static void vp_del_vq(struct virtqueue *vq)
> iowrite32(0, vp_dev->ioaddr...
2018 Jul 30
1
[RFC 1/4] virtio: Define virtio_direct_dma_ops structure
...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;
queue is a very odd name in a generic memory allocator.
> +void virtio_direct_free(struct device *dev, size_t size, void *vaddr,
> + dma_addr_t dma_addr, unsigned long attrs)
> +{
> + free_pages_e...
2014 Oct 25
0
[RFC PATCH 1/2] Add a new register offset let interrupt reason available
...= readl(vm_dev->base + VIRTIO_MMIO_VENDOR_ID);
@@ -488,13 +500,20 @@ static int virtio_mmio_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, vm_dev);
- return register_virtio_device(&vm_dev->vdev);
+ err = register_virtio_device(&vm_dev->vdev);
+ if (err) {
+ free_pages_exact(vm_dev->isr_mem, PAGE_SIZE);
+ vm_dev->isr_mem = NULL;
+ }
+
+ return err;
}
static int virtio_mmio_remove(struct platform_device *pdev)
{
struct virtio_mmio_device *vm_dev = platform_get_drvdata(pdev);
+ free_pages_exact(vm_dev->isr_mem, PAGE_SIZE);
unregister_virtio_device(&a...
2014 Sep 17
0
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...N, vdev,
- true, false, info->queue,
+ true, info->use_dma_api, info->queue,
vp_notify, callback, name);
if (!vq) {
err = -ENOMEM;
@@ -463,7 +518,12 @@ out_assign:
vring_del_virtqueue(vq);
out_activate_queue:
iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
- free_pages_exact(info->queue, size);
+ if (info->use_dma_api) {
+ dma_free_coherent(vdev->dev.parent, size,
+ info->queue, info->queue_dma_addr);
+ } else {
+ free_pages_exact(info->queue, PAGE_ALIGN(size));
+ }
out_info:
kfree(info);
return ERR_PTR(err);
@@ -493,8 +553,13 @@ static vo...
2014 Sep 17
0
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...vp_notify, callback, name);
>> if (!vq) {
>> err = -ENOMEM;
>> @@ -463,7 +518,12 @@ out_assign:
>> vring_del_virtqueue(vq);
>> out_activate_queue:
>> iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
>> - free_pages_exact(info->queue, size);
>> + if (info->use_dma_api) {
>> + dma_free_coherent(vdev->dev.parent, size,
>> + info->queue, info->queue_dma_addr);
>> + } else {
>> + free_pages_exact(info->queue, PA...
2017 Sep 25
0
[PATCH v1 1/4] KVM/vmx: re-write the msr auto switch feature
...+ size_t bytes = msr_autoload_count_max * sizeof(struct vmx_msr_entry);
if (enable_pml)
vmx_destroy_pml_buffer(vmx);
@@ -9512,15 +9549,17 @@ static void vmx_free_vcpu(struct kvm_vcpu *vcpu)
vmx_free_vcpu_nested(vcpu);
free_loaded_vmcs(vmx->loaded_vmcs);
kfree(vmx->guest_msrs);
+ free_pages_exact(vmx->msr_autoload.host, bytes);
+ free_pages_exact(vmx->msr_autoload.guest, bytes);
kvm_vcpu_uninit(vcpu);
kmem_cache_free(kvm_vcpu_cache, vmx);
}
static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
{
- int err;
+ int err, cpu;
+ size_t bytes;
struct vcpu_vmx...
2014 Sep 17
0
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...fo->queue,
> > vp_notify, callback, name);
> > if (!vq) {
> > err = -ENOMEM;
> > @@ -463,7 +518,12 @@ out_assign:
> > vring_del_virtqueue(vq);
> > out_activate_queue:
> > iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
> > - free_pages_exact(info->queue, size);
> > + if (info->use_dma_api) {
> > + dma_free_coherent(vdev->dev.parent, size,
> > + info->queue, info->queue_dma_addr);
> > + } else {
> > + free_pages_exact(info->queue, PAGE_ALIGN(size));
> > + }
> > out_info...
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,
2014 Aug 26
0
[PATCH 3/3] virtio_pci: Use the DMA API for virtqueues
...DDR_SHIFT,
+ iowrite32(info->queue_dma_addr >> VIRTIO_PCI_QUEUE_ADDR_SHIFT,
vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
/* create the vring */
@@ -462,7 +464,8 @@ out_assign:
vring_del_virtqueue(vq);
out_activate_queue:
iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
- free_pages_exact(info->queue, size);
+ dma_free_coherent(vdev->dev.parent, size,
+ info->queue, info->queue_dma_addr);
out_info:
kfree(info);
return ERR_PTR(err);
@@ -493,7 +496,8 @@ static void vp_del_vq(struct virtqueue *vq)
iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
size =...
2014 Oct 26
0
[RFC PATCH 1/2] Add a new register offset let interrupt reason available
...ID);
>
> @@ -488,13 +500,20 @@ static int virtio_mmio_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, vm_dev);
>
> - return register_virtio_device(&vm_dev->vdev);
> + err = register_virtio_device(&vm_dev->vdev);
> + if (err) {
> + free_pages_exact(vm_dev->isr_mem, PAGE_SIZE);
> + vm_dev->isr_mem = NULL;
> + }
> +
> + return err;
> }
>
> static int virtio_mmio_remove(struct platform_device *pdev)
> {
> struct virtio_mmio_device *vm_dev = platform_get_drvdata(pdev);
>
> + free_pages_exact(vm_dev...
2014 Aug 27
0
[PATCH 3/3] virtio_pci: Use the DMA API for virtqueues
...vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
>>
>> /* create the vring */
>> @@ -462,7 +464,8 @@ out_assign:
>> vring_del_virtqueue(vq);
>> out_activate_queue:
>> iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
>> - free_pages_exact(info->queue, size);
>> + dma_free_coherent(vdev->dev.parent, size,
>> + info->queue, info->queue_dma_addr);
>> out_info:
>> kfree(info);
>> return ERR_PTR(err);
>> @@ -493,7 +496,8 @@ static void vp_del_vq(struct...
2018 Jul 20
0
[RFC 1/4] virtio: Define virtio_direct_dma_ops structure
...*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 device *dev, size_t size, void *vaddr,
+ dma_addr_t dma_addr, unsigned long attrs)
+{
+ free_pages_exact(vaddr, PAGE_ALIGN(size));
+}
+
+const struct dma_map_ops virtio_direct_dma_ops = {
+ .al...
2019 Apr 26
0
[PATCH 01/10] virtio/s390: use vring_create_virtqueue
...ed long flags;
- unsigned long size;
int ret;
unsigned int index = vq->index;
@@ -461,8 +459,6 @@ static void virtio_ccw_del_vq(struct virtqueue *vq, struct ccw1 *ccw)
ret, index);
vring_del_virtqueue(vq);
- size = PAGE_ALIGN(vring_size(info->num, KVM_VIRTIO_CCW_RING_ALIGN));
- free_pages_exact(info->queue, size);
kfree(info->info_block);
kfree(info);
}
@@ -494,8 +490,9 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
int err;
struct virtqueue *vq = NULL;
struct virtio_ccw_vq_info *info;
- unsigned long size = 0; /* silence the compiler */
+ u64...
2014 Dec 08
0
[PATCH v2 06/10] virtio_pci: setup vqs indirectly
...ix_vec, vp_dev->ioaddr + VIRTIO_MSI_QUEUE_VECTOR);
@@ -449,6 +447,35 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
}
}
+ return vq;
+
+out_assign:
+ vring_del_virtqueue(vq);
+out_activate_queue:
+ iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
+ free_pages_exact(info->queue, size);
+ return ERR_PTR(err);
+}
+
+static struct virtqueue *vp_setup_vq(struct virtio_device *vdev, unsigned index,
+ void (*callback)(struct virtqueue *vq),
+ const char *name,
+ u16 msix_vec)
+{
+ struct virtio_pci_device *vp_dev = to_vp_device(vdev);
+ st...