Skip to contentSkip to conversation

of_reserved_mem_device_init_by_idx() returns -EINVAL if "memory-region" is missing

DISCUSSION Alexey Brodkin 2 participants 3 messages Jun 16, 2016 – Jun 17, 2016 Synopsys ARC architecture

lore
Share & tools
lore
#0 lore raw

Hi Marek,

We used to use of_reserved_mem_device_init() in such a context in GPU drivers:
-------------------->8-------------------

	/* Get the optional framebuffer memory resource */
	ret = of_reserved_mem_device_init(drm->dev);
	if (ret && ret != -ENODEV)
		return ret;

-------------------->8-------------------

The point is we may have a dedicated reserved memory area or may not have (depends on a particular .dts). Our expectation is if reserved memory area is missing then of_reserved_mem_device_init() just returns -ENODEV and it used to work like this.

Now with your commit 59ce4039727e "of: reserved_mem: add support for using more than one region for given device" behavior is different. of_reserved_mem_device_init_by_idx() has this:
-------------------->8-------------------

	target = of_parse_phandle(np, "memory-region", idx);
	if (!target)
		return -EINVAL;

-------------------->8-------------------

So I'm wondering which part should be fixed:
 1) of_reserved_mem itself or
 2) users of of_reserved_mem_device_init()

Any thoughts?

Regards,
Alexey
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#1 lore raw

Hi Alexey

Quoted 20 lines · Alexey Brodkin

Hi Marek,

We used to use of_reserved_mem_device_init() in such a context in GPU drivers:
-------------------->8-------------------

	/* Get the optional framebuffer memory resource */
	ret = of_reserved_mem_device_init(drm->dev);
	if (ret && ret != -ENODEV)
		return ret;

-------------------->8-------------------

The point is we may have a dedicated reserved memory area or may not have (depends on a particular .dts). Our expectation is if reserved memory area is missing then of_reserved_mem_device_init() just returns -ENODEV and it used to work like this.

Now with your commit 59ce4039727e "of: reserved_mem: add support for using more than one region for given device" behavior is different. of_reserved_mem_device_init_by_idx() has this:
-------------------->8-------------------

	target = of_parse_phandle(np, "memory-region", idx);
	if (!target)
		return -EINVAL;
Quoted 7 lines

-------------------->8-------------------

So I'm wondering which part should be fixed:
1) of_reserved_mem itself or
2) users of of_reserved_mem_device_init()

Any thoughts?

This was my fault. The fix is already queued to linux-next, see commit 9f5a802b1d51dc80a27d828a5f7dcc8ec4a72f03 ("[media] of: reserved_mem: restore old behavior when no region is defined"),
http://www.spinics.net/lists/linux-media/msg100972.html

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland
#2 lore raw

Hi Marek,

Quoted 31 lines · Marek Szyprowski

Hi Alexey

Quoted 27 lines · Alexey Brodkin

Hi Marek,

We used to use of_reserved_mem_device_init() in such a context in GPU drivers:
-------------------->8-------------------

	/* Get the optional framebuffer memory resource */
	ret = of_reserved_mem_device_init(drm->dev);
	if (ret && ret != -ENODEV)
		return ret;

-------------------->8-------------------

The point is we may have a dedicated reserved memory area or may not have (depends on a particular .dts). Our expectation is if reserved memory area is missing then of_reserved_mem_device_init() just returns -ENODEV and it used to work like this.

Now with your commit 59ce4039727e "of: reserved_mem: add support for using more than one region for given device" behavior is different. of_reserved_mem_device_init_by_idx() has this:
-------------------->8-------------------

	target = of_parse_phandle(np, "memory-region", idx);
	if (!target)
		return -EINVAL;

-------------------->8-------------------

So I'm wondering which part should be fixed:
 1) of_reserved_mem itself or
 2) users of of_reserved_mem_device_init()

Quoted 7 lines
Quoted 1 line

Any thoughts?

This was my fault. The fix is already queued to linux-next, see commit 9f5a802b1d51dc80a27d828a5f7dcc8ec4a72f03 ("[media] of: reserved_mem: restore old behavior when no region is defined"),
http://www.spinics.net/lists/linux-media/msg100972.html

Indeed with mentioned fix GPU driver now works again! Sorry for the noise and thank you for fixing it that fast.

Regards,
Alexey
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc