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

Commit 07350074 authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Move memory pool initialization to the KGSL core



In the code the memory pools are generic. They are stored in global memory
and none of the APIs take a device handle, yet the device tree description
has traditionally been device specific and as such the pools were set up
at device initialization time.

This is not needed as we can safely look up the memory pools node from the
compatible string at any point. Make the memory pools completely generic
and initialize them with the rest of the KGSL core. This clears the way
to move the memory definitions out of the device and into the top level
soc in the device tree, but since we are using the compatible string
that isn't strictly necessary.

Change-Id: Ic0dedbad687b9581f0e40142644ed19ee069d54d
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent dc333aea
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -4972,9 +4972,6 @@ int kgsl_device_platform_probe(struct kgsl_device *device)
	if (status)
		goto error_close_mmu;

	/* Initialize the memory pools */
	kgsl_init_page_pools(device->pdev);

	device->events_wq = alloc_workqueue("kgsl-events",
		WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS, 0);

@@ -5000,8 +4997,6 @@ void kgsl_device_platform_remove(struct kgsl_device *device)

	kgsl_device_snapshot_close(device);

	kgsl_exit_page_pools();

	kobject_put(device->gpu_sysfs_kobj);

	idr_destroy(&device->context_idr);
@@ -5022,6 +5017,8 @@ void kgsl_device_platform_remove(struct kgsl_device *device)

void kgsl_core_exit(void)
{
	kgsl_exit_page_pools();

	kgsl_events_exit();
	kgsl_core_debugfs_close();

@@ -5111,6 +5108,9 @@ int __init kgsl_core_init(void)

	kgsl_sharedmem_init_sysfs();

	/* Initialize the memory pools */
	kgsl_probe_page_pools();

	INIT_LIST_HEAD(&kgsl_driver.process_list);

	INIT_LIST_HEAD(&kgsl_driver.pagetable_list);
+2 −8
Original line number Diff line number Diff line
@@ -599,12 +599,12 @@ static int kgsl_of_parse_mempool(struct kgsl_page_pool *pool,
	return 0;
}

static void kgsl_of_get_mempools(struct device_node *parent)
void kgsl_probe_page_pools(void)
{
	struct device_node *node, *child;
	int index = 0;

	node = of_find_compatible_node(parent, NULL, "qcom,gpu-mempools");
	node = of_find_compatible_node(NULL, NULL, "qcom,gpu-mempools");
	if (!node)
		return;

@@ -624,12 +624,6 @@ static void kgsl_of_get_mempools(struct device_node *parent)

	kgsl_num_pools = index;
	of_node_put(node);
}

void kgsl_init_page_pools(struct platform_device *pdev)
{
	/* Get GPU mempools data and configure pools */
	kgsl_of_get_mempools(pdev->dev.of_node);

	/* Initialize shrinker */
	register_shrinker(&kgsl_pool_shrinker);
+9 −1
Original line number Diff line number Diff line
@@ -33,7 +33,15 @@ int kgsl_pool_alloc_pages(u64 size, struct page ***pages, struct device *dev);
 * otherwise they are given back to system.
 */
void kgsl_pool_free_pages(struct page **pages, unsigned int page_count);
void kgsl_init_page_pools(struct platform_device *pdev);

/**
 * kgsl_probe_page_pools - Initialize the memory pools pools
 */
void kgsl_probe_page_pools(void);

/**
 * kgsl_exit_page_pools - Free outstanding pooled memory
 */
void kgsl_exit_page_pools(void);
#endif /* __KGSL_POOL_H */