Skip to content

Commit 2245932

Browse files
Sebastian OttMartin Schwidefsky
authored andcommitted
s390/pci: use virtual memory for iommu bitmap
The bitmap used to mark dma mappings can be quite large on systems with huge amounts of memory. Use virtual memory for this bitmap. Suggested-by: Alexander Schmidt <[email protected]> Reviewed-by: Gerald Schaefer <[email protected]> Signed-off-by: Sebastian Ott <[email protected]> Signed-off-by: Martin Schwidefsky <[email protected]>
1 parent eb072a7 commit 2245932

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

arch/s390/pci/pci_dma.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/export.h>
1111
#include <linux/iommu-helper.h>
1212
#include <linux/dma-mapping.h>
13+
#include <linux/vmalloc.h>
1314
#include <linux/pci.h>
1415
#include <asm/pci_dma.h>
1516

@@ -407,7 +408,6 @@ static void s390_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
407408

408409
int zpci_dma_init_device(struct zpci_dev *zdev)
409410
{
410-
unsigned int bitmap_order;
411411
int rc;
412412

413413
spin_lock_init(&zdev->iommu_bitmap_lock);
@@ -421,12 +421,7 @@ int zpci_dma_init_device(struct zpci_dev *zdev)
421421

422422
zdev->iommu_size = (unsigned long) high_memory - PAGE_OFFSET;
423423
zdev->iommu_pages = zdev->iommu_size >> PAGE_SHIFT;
424-
bitmap_order = get_order(zdev->iommu_pages / 8);
425-
pr_info("iommu_size: 0x%lx iommu_pages: 0x%lx bitmap_order: %i\n",
426-
zdev->iommu_size, zdev->iommu_pages, bitmap_order);
427-
428-
zdev->iommu_bitmap = (void *) __get_free_pages(GFP_KERNEL | __GFP_ZERO,
429-
bitmap_order);
424+
zdev->iommu_bitmap = vzalloc(zdev->iommu_pages / 8);
430425
if (!zdev->iommu_bitmap) {
431426
rc = -ENOMEM;
432427
goto out_reg;
@@ -451,8 +446,7 @@ void zpci_dma_exit_device(struct zpci_dev *zdev)
451446
{
452447
zpci_unregister_ioat(zdev, 0);
453448
dma_cleanup_tables(zdev);
454-
free_pages((unsigned long) zdev->iommu_bitmap,
455-
get_order(zdev->iommu_pages / 8));
449+
vfree(zdev->iommu_bitmap);
456450
zdev->iommu_bitmap = NULL;
457451
zdev->next_bit = 0;
458452
}

0 commit comments

Comments
 (0)