Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0cdc4fc7 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "iommu/io-pgtable: Add support for io-pgtable accounting"

parents c67bc4a3 4315d00d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ CONFIG_LOCALVERSION="-qgki-consolidate"
CONFIG_IOMMU_TLBSYNC_DEBUG=y
CONFIG_IOMMU_DEBUG=y
CONFIG_IOMMU_TESTS=y
CONFIG_IO_PGTABLE_PAGE_ACCOUNTING=y
CONFIG_CMA_DEBUGFS=y
CONFIG_CMA_DEBUG=y
CONFIG_DEBUG_PAGEALLOC=y
+0 −1
Original line number Diff line number Diff line
CONFIG_LOCALVERSION="-qgki-debug"
CONFIG_SLUB_DEBUG_PANIC_ON=y
CONFIG_IO_PGTABLE_PAGE_ACCOUNTING=y
CONFIG_SLUB_DEBUG_ON=y
CONFIG_DEBUG_KMEMLEAK=y
CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=4000
+12 −2
Original line number Diff line number Diff line
@@ -149,19 +149,27 @@ void *io_pgtable_alloc_pages(struct io_pgtable_cfg *cfg, void *cookie,
{
	struct device *dev;
	struct page *p;
	void *page_addr;

	if (!cfg)
		return NULL;

	if (cfg->iommu_pgtable_ops && cfg->iommu_pgtable_ops->alloc_pgtable)
		return cfg->iommu_pgtable_ops->alloc_pgtable(cookie, order,
	if (cfg->iommu_pgtable_ops && cfg->iommu_pgtable_ops->alloc_pgtable) {
		page_addr = cfg->iommu_pgtable_ops->alloc_pgtable(cookie, order,
							     gfp_mask);
		if (likely(page_addr))
			mod_pages_allocated(1 << order);

		return page_addr;
	}

	dev = cfg->iommu_dev;
	p =  alloc_pages_node(dev ? dev_to_node(dev) : NUMA_NO_NODE,
			      gfp_mask, order);
	if (!p)
		return NULL;

	mod_pages_allocated(1 << order);
	return page_address(p);
}

@@ -175,4 +183,6 @@ void io_pgtable_free_pages(struct io_pgtable_cfg *cfg, void *cookie, void *virt,
		cfg->iommu_pgtable_ops->free_pgtable(cookie, virt, order);
	else
		free_pages((unsigned long)virt, order);

	mod_pages_allocated(-(1 << order));
}