All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: sprd: Add reserved DMA memory support
@ 2019-04-12  6:40 Baolin Wang
  2019-04-18 10:26   ` Mark Brown
  2019-05-06 13:51   ` Mark Brown
  0 siblings, 2 replies; 8+ messages in thread
From: Baolin Wang @ 2019-04-12  6:40 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai
  Cc: linux-kernel, alsa-devel, baolin.wang, orsonzhai, zhang.lyra

For Spreadtrum audio platform driver, it need allocate a larger DMA buffer
dynamically to copy audio data between userspace and kernel space, but that
will increase the risk of memory allocation failure especially the system
is under heavy load situation.

To make sure the audio can work in this scenario, we usually reserve one
region of memory to be used as a shared pool of DMA buffers for the
platform component. So add of_reserved_mem_device_init_by_idx() function
to initialize the shared pool of DMA buffers to be used by the platform
component.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 sound/soc/sprd/sprd-pcm-dma.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/sprd/sprd-pcm-dma.c b/sound/soc/sprd/sprd-pcm-dma.c
index 9be6d4b..d38ebbb 100644
--- a/sound/soc/sprd/sprd-pcm-dma.c
+++ b/sound/soc/sprd/sprd-pcm-dma.c
@@ -6,6 +6,7 @@
 #include <linux/dma/sprd-dma.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -530,8 +531,14 @@ static void sprd_pcm_free(struct snd_pcm *pcm)
 
 static int sprd_soc_platform_probe(struct platform_device *pdev)
 {
+	struct device_node *np = pdev->dev.of_node;
 	int ret;
 
+	ret = of_reserved_mem_device_init_by_idx(&pdev->dev, np, 0);
+	if (ret)
+		dev_warn(&pdev->dev,
+			 "no reserved DMA memory for audio platform device\n");
+
 	ret = devm_snd_soc_register_component(&pdev->dev, &sprd_soc_component,
 					      NULL, 0);
 	if (ret)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Applied "ASoC: sprd: Add reserved DMA memory support" to the asoc tree
  2019-04-12  6:40 [PATCH] ASoC: sprd: Add reserved DMA memory support Baolin Wang
@ 2019-04-18 10:26   ` Mark Brown
  2019-05-06 13:51   ` Mark Brown
  1 sibling, 0 replies; 8+ messages in thread
From: Mark Brown @ 2019-04-18 10:26 UTC (permalink / raw)
  To: Baolin Wang
  Cc: alsa-devel, baolin.wang, broonie, lgirdwood, linux-kernel,
	Mark Brown, orsonzhai, perex, tiwai, zhang.lyra

The patch

   ASoC: sprd: Add reserved DMA memory support

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 25a073bb9ceda91b8bf731b20ac01b68cc8877a9 Mon Sep 17 00:00:00 2001
From: Baolin Wang <baolin.wang@linaro.org>
Date: Fri, 12 Apr 2019 14:40:17 +0800
Subject: [PATCH] ASoC: sprd: Add reserved DMA memory support

For Spreadtrum audio platform driver, it need allocate a larger DMA buffer
dynamically to copy audio data between userspace and kernel space, but that
will increase the risk of memory allocation failure especially the system
is under heavy load situation.

To make sure the audio can work in this scenario, we usually reserve one
region of memory to be used as a shared pool of DMA buffers for the
platform component. So add of_reserved_mem_device_init_by_idx() function
to initialize the shared pool of DMA buffers to be used by the platform
component.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sprd/sprd-pcm-dma.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/sprd/sprd-pcm-dma.c b/sound/soc/sprd/sprd-pcm-dma.c
index 9be6d4b2bf74..d38ebbbbf169 100644
--- a/sound/soc/sprd/sprd-pcm-dma.c
+++ b/sound/soc/sprd/sprd-pcm-dma.c
@@ -6,6 +6,7 @@
 #include <linux/dma/sprd-dma.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -530,8 +531,14 @@ static const struct snd_soc_component_driver sprd_soc_component = {
 
 static int sprd_soc_platform_probe(struct platform_device *pdev)
 {
+	struct device_node *np = pdev->dev.of_node;
 	int ret;
 
+	ret = of_reserved_mem_device_init_by_idx(&pdev->dev, np, 0);
+	if (ret)
+		dev_warn(&pdev->dev,
+			 "no reserved DMA memory for audio platform device\n");
+
 	ret = devm_snd_soc_register_component(&pdev->dev, &sprd_soc_component,
 					      NULL, 0);
 	if (ret)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Applied "ASoC: sprd: Add reserved DMA memory support" to the asoc tree
@ 2019-04-18 10:26   ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2019-04-18 10:26 UTC (permalink / raw)
  Cc: alsa-devel, baolin.wang, broonie, lgirdwood, linux-kernel

The patch

   ASoC: sprd: Add reserved DMA memory support

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 25a073bb9ceda91b8bf731b20ac01b68cc8877a9 Mon Sep 17 00:00:00 2001
From: Baolin Wang <baolin.wang@linaro.org>
Date: Fri, 12 Apr 2019 14:40:17 +0800
Subject: [PATCH] ASoC: sprd: Add reserved DMA memory support

For Spreadtrum audio platform driver, it need allocate a larger DMA buffer
dynamically to copy audio data between userspace and kernel space, but that
will increase the risk of memory allocation failure especially the system
is under heavy load situation.

To make sure the audio can work in this scenario, we usually reserve one
region of memory to be used as a shared pool of DMA buffers for the
platform component. So add of_reserved_mem_device_init_by_idx() function
to initialize the shared pool of DMA buffers to be used by the platform
component.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sprd/sprd-pcm-dma.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/sprd/sprd-pcm-dma.c b/sound/soc/sprd/sprd-pcm-dma.c
index 9be6d4b2bf74..d38ebbbbf169 100644
--- a/sound/soc/sprd/sprd-pcm-dma.c
+++ b/sound/soc/sprd/sprd-pcm-dma.c
@@ -6,6 +6,7 @@
 #include <linux/dma/sprd-dma.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -530,8 +531,14 @@ static const struct snd_soc_component_driver sprd_soc_component = {
 
 static int sprd_soc_platform_probe(struct platform_device *pdev)
 {
+	struct device_node *np = pdev->dev.of_node;
 	int ret;
 
+	ret = of_reserved_mem_device_init_by_idx(&pdev->dev, np, 0);
+	if (ret)
+		dev_warn(&pdev->dev,
+			 "no reserved DMA memory for audio platform device\n");
+
 	ret = devm_snd_soc_register_component(&pdev->dev, &sprd_soc_component,
 					      NULL, 0);
 	if (ret)
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Applied "ASoC: sprd: Add reserved DMA memory support" to the asoc tree
  2019-04-18 10:26   ` Mark Brown
  (?)
@ 2019-05-06  7:37   ` Baolin Wang
  2019-05-06 13:48     ` Mark Brown
  -1 siblings, 1 reply; 8+ messages in thread
From: Baolin Wang @ 2019-05-06  7:37 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Liam Girdwood, LKML, Orson Zhai, Jaroslav Kysela,
	Takashi Iwai, Chunyan Zhang

Hi Mark,

On Thu, 18 Apr 2019 at 18:26, Mark Brown <broonie@kernel.org> wrote:
>
> The patch
>
>    ASoC: sprd: Add reserved DMA memory support
>
> has been applied to the asoc tree at
>
>    https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2
>
> All being well this means that it will be integrated into the linux-next
> tree (usually sometime in the next 24 hours) and sent to Linus during
> the next merge window (or sooner if it is a bug fix), however if
> problems are discovered then the patch may be dropped or reverted.
>
> You may get further e-mails resulting from automated or manual testing
> and review of the tree, please engage with people reporting problems and
> send followup patches addressing any issues that are reported if needed.
>
> If any updates are required or you are submitting further changes they
> should be sent as incremental updates against current git, existing
> patches will not be replaced.
>
> Please add any relevant lists and maintainers to the CCs when replying
> to this mail.

I did not find this patch in your sound git tree and the linux-next
tree, so could you check if you missed this patch? Or did I miss
anything? Thanks a lot.

>
> Thanks,
> Mark
>
> From 25a073bb9ceda91b8bf731b20ac01b68cc8877a9 Mon Sep 17 00:00:00 2001
> From: Baolin Wang <baolin.wang@linaro.org>
> Date: Fri, 12 Apr 2019 14:40:17 +0800
> Subject: [PATCH] ASoC: sprd: Add reserved DMA memory support
>
> For Spreadtrum audio platform driver, it need allocate a larger DMA buffer
> dynamically to copy audio data between userspace and kernel space, but that
> will increase the risk of memory allocation failure especially the system
> is under heavy load situation.
>
> To make sure the audio can work in this scenario, we usually reserve one
> region of memory to be used as a shared pool of DMA buffers for the
> platform component. So add of_reserved_mem_device_init_by_idx() function
> to initialize the shared pool of DMA buffers to be used by the platform
> component.
>
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  sound/soc/sprd/sprd-pcm-dma.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/sound/soc/sprd/sprd-pcm-dma.c b/sound/soc/sprd/sprd-pcm-dma.c
> index 9be6d4b2bf74..d38ebbbbf169 100644
> --- a/sound/soc/sprd/sprd-pcm-dma.c
> +++ b/sound/soc/sprd/sprd-pcm-dma.c
> @@ -6,6 +6,7 @@
>  #include <linux/dma/sprd-dma.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
> +#include <linux/of_reserved_mem.h>
>  #include <linux/platform_device.h>
>  #include <sound/pcm.h>
>  #include <sound/pcm_params.h>
> @@ -530,8 +531,14 @@ static const struct snd_soc_component_driver sprd_soc_component = {
>
>  static int sprd_soc_platform_probe(struct platform_device *pdev)
>  {
> +       struct device_node *np = pdev->dev.of_node;
>         int ret;
>
> +       ret = of_reserved_mem_device_init_by_idx(&pdev->dev, np, 0);
> +       if (ret)
> +               dev_warn(&pdev->dev,
> +                        "no reserved DMA memory for audio platform device\n");
> +
>         ret = devm_snd_soc_register_component(&pdev->dev, &sprd_soc_component,
>                                               NULL, 0);
>         if (ret)
> --
> 2.20.1
>


-- 
Baolin Wang
Best Regards

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Applied "ASoC: sprd: Add reserved DMA memory support" to the asoc tree
  2019-05-06  7:37   ` Baolin Wang
@ 2019-05-06 13:48     ` Mark Brown
  2019-05-07  2:24       ` Baolin Wang
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2019-05-06 13:48 UTC (permalink / raw)
  To: Baolin Wang
  Cc: alsa-devel, Liam Girdwood, LKML, Orson Zhai, Jaroslav Kysela,
	Takashi Iwai, Chunyan Zhang

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

On Mon, May 06, 2019 at 03:37:39PM +0800, Baolin Wang wrote:

> I did not find this patch in your sound git tree and the linux-next
> tree, so could you check if you missed this patch? Or did I miss
> anything? Thanks a lot.

Something seems to have gone wrong at some point which caused some
patches to go AWOL, not sure what.  I thought I'd caught all of them but
I guess not this one, I restored it now.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Applied "ASoC: sprd: Add reserved DMA memory support" to the asoc tree
  2019-04-12  6:40 [PATCH] ASoC: sprd: Add reserved DMA memory support Baolin Wang
@ 2019-05-06 13:51   ` Mark Brown
  2019-05-06 13:51   ` Mark Brown
  1 sibling, 0 replies; 8+ messages in thread
From: Mark Brown @ 2019-05-06 13:51 UTC (permalink / raw)
  To: Baolin Wang
  Cc: alsa-devel, baolin.wang, broonie, lgirdwood, linux-kernel,
	Mark Brown, orsonzhai, perex, tiwai, zhang.lyra

The patch

   ASoC: sprd: Add reserved DMA memory support

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 1587a061ef562de0d97c82a95863e191bcd69d63 Mon Sep 17 00:00:00 2001
From: Baolin Wang <baolin.wang@linaro.org>
Date: Fri, 12 Apr 2019 14:40:17 +0800
Subject: [PATCH] ASoC: sprd: Add reserved DMA memory support

For Spreadtrum audio platform driver, it need allocate a larger DMA buffer
dynamically to copy audio data between userspace and kernel space, but that
will increase the risk of memory allocation failure especially the system
is under heavy load situation.

To make sure the audio can work in this scenario, we usually reserve one
region of memory to be used as a shared pool of DMA buffers for the
platform component. So add of_reserved_mem_device_init_by_idx() function
to initialize the shared pool of DMA buffers to be used by the platform
component.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sprd/sprd-pcm-dma.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/sprd/sprd-pcm-dma.c b/sound/soc/sprd/sprd-pcm-dma.c
index 9be6d4b2bf74..d38ebbbbf169 100644
--- a/sound/soc/sprd/sprd-pcm-dma.c
+++ b/sound/soc/sprd/sprd-pcm-dma.c
@@ -6,6 +6,7 @@
 #include <linux/dma/sprd-dma.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -530,8 +531,14 @@ static const struct snd_soc_component_driver sprd_soc_component = {
 
 static int sprd_soc_platform_probe(struct platform_device *pdev)
 {
+	struct device_node *np = pdev->dev.of_node;
 	int ret;
 
+	ret = of_reserved_mem_device_init_by_idx(&pdev->dev, np, 0);
+	if (ret)
+		dev_warn(&pdev->dev,
+			 "no reserved DMA memory for audio platform device\n");
+
 	ret = devm_snd_soc_register_component(&pdev->dev, &sprd_soc_component,
 					      NULL, 0);
 	if (ret)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Applied "ASoC: sprd: Add reserved DMA memory support" to the asoc tree
@ 2019-05-06 13:51   ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2019-05-06 13:51 UTC (permalink / raw)
  Cc: alsa-devel, baolin.wang, broonie, lgirdwood, linux-kernel

The patch

   ASoC: sprd: Add reserved DMA memory support

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 1587a061ef562de0d97c82a95863e191bcd69d63 Mon Sep 17 00:00:00 2001
From: Baolin Wang <baolin.wang@linaro.org>
Date: Fri, 12 Apr 2019 14:40:17 +0800
Subject: [PATCH] ASoC: sprd: Add reserved DMA memory support

For Spreadtrum audio platform driver, it need allocate a larger DMA buffer
dynamically to copy audio data between userspace and kernel space, but that
will increase the risk of memory allocation failure especially the system
is under heavy load situation.

To make sure the audio can work in this scenario, we usually reserve one
region of memory to be used as a shared pool of DMA buffers for the
platform component. So add of_reserved_mem_device_init_by_idx() function
to initialize the shared pool of DMA buffers to be used by the platform
component.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sprd/sprd-pcm-dma.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/sprd/sprd-pcm-dma.c b/sound/soc/sprd/sprd-pcm-dma.c
index 9be6d4b2bf74..d38ebbbbf169 100644
--- a/sound/soc/sprd/sprd-pcm-dma.c
+++ b/sound/soc/sprd/sprd-pcm-dma.c
@@ -6,6 +6,7 @@
 #include <linux/dma/sprd-dma.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -530,8 +531,14 @@ static const struct snd_soc_component_driver sprd_soc_component = {
 
 static int sprd_soc_platform_probe(struct platform_device *pdev)
 {
+	struct device_node *np = pdev->dev.of_node;
 	int ret;
 
+	ret = of_reserved_mem_device_init_by_idx(&pdev->dev, np, 0);
+	if (ret)
+		dev_warn(&pdev->dev,
+			 "no reserved DMA memory for audio platform device\n");
+
 	ret = devm_snd_soc_register_component(&pdev->dev, &sprd_soc_component,
 					      NULL, 0);
 	if (ret)
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Applied "ASoC: sprd: Add reserved DMA memory support" to the asoc tree
  2019-05-06 13:48     ` Mark Brown
@ 2019-05-07  2:24       ` Baolin Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Baolin Wang @ 2019-05-07  2:24 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Liam Girdwood, LKML, Orson Zhai, Jaroslav Kysela,
	Takashi Iwai, Chunyan Zhang

On Mon, 6 May 2019 at 21:49, Mark Brown <broonie@kernel.org> wrote:
>
> On Mon, May 06, 2019 at 03:37:39PM +0800, Baolin Wang wrote:
>
> > I did not find this patch in your sound git tree and the linux-next
> > tree, so could you check if you missed this patch? Or did I miss
> > anything? Thanks a lot.
>
> Something seems to have gone wrong at some point which caused some
> patches to go AWOL, not sure what.  I thought I'd caught all of them but
> I guess not this one, I restored it now.

OK. Thanks :)

-- 
Baolin Wang
Best Regards

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-05-07  2:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12  6:40 [PATCH] ASoC: sprd: Add reserved DMA memory support Baolin Wang
2019-04-18 10:26 ` Applied "ASoC: sprd: Add reserved DMA memory support" to the asoc tree Mark Brown
2019-04-18 10:26   ` Mark Brown
2019-05-06  7:37   ` Baolin Wang
2019-05-06 13:48     ` Mark Brown
2019-05-07  2:24       ` Baolin Wang
2019-05-06 13:51 ` Mark Brown
2019-05-06 13:51   ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.