alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: mediatek: support memory-region assignment
@ 2021-11-30  5:39 Trevor Wu
  2021-11-30  5:39 ` [PATCH 1/2] ASoC: mediatek: mt8195: support reserved memory assignment Trevor Wu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Trevor Wu @ 2021-11-30  5:39 UTC (permalink / raw)
  To: broonie, tiwai, robh+dt, matthias.bgg
  Cc: devicetree, alsa-devel, linux-kernel, linux-mediatek, trevor.wu,
	yc.hung, linux-arm-kernel

This series of patches adds support for memory-region assignment, so the 
access region of DMA engine could be restricted.
Patches are based on broonie tree "for-next" branch.

Trevor Wu (2):
  ASoC: mediatek: mt8195: support reserved memory assignment
  dt-bindings: mediatek: mt8195: add memory-region property

 .../devicetree/bindings/sound/mt8195-afe-pcm.yaml         | 8 ++++++++
 sound/soc/mediatek/mt8195/mt8195-afe-pcm.c                | 7 +++++++
 2 files changed, 15 insertions(+)

-- 
2.18.0


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

* [PATCH 1/2] ASoC: mediatek: mt8195: support reserved memory assignment
  2021-11-30  5:39 [PATCH 0/2] ASoC: mediatek: support memory-region assignment Trevor Wu
@ 2021-11-30  5:39 ` Trevor Wu
  2021-11-30  5:39 ` [PATCH 2/2] dt-bindings: mediatek: mt8195: add memory-region property Trevor Wu
  2021-12-06 18:00 ` [PATCH 0/2] ASoC: mediatek: support memory-region assignment Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Trevor Wu @ 2021-11-30  5:39 UTC (permalink / raw)
  To: broonie, tiwai, robh+dt, matthias.bgg
  Cc: devicetree, alsa-devel, linux-kernel, linux-mediatek, trevor.wu,
	yc.hung, linux-arm-kernel

For security purpose, restrict the memory assess region of AFE memif.
The specified memory region should be assigned from DTS.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
---
 sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
index 2bb05a828e8d..8a6db24116e3 100644
--- a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
+++ b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c
@@ -14,6 +14,7 @@
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/pm_runtime.h>
 #include "mt8195-afe-common.h"
 #include "mt8195-afe-clk.h"
@@ -3061,6 +3062,12 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev)
 	int i, irq_id, ret;
 	struct snd_soc_component *component;
 
+	ret = of_reserved_mem_device_init(dev);
+	if (ret) {
+		dev_err(dev, "failed to assign memory region: %d\n", ret);
+		return ret;
+	}
+
 	ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(33));
 	if (ret)
 		return ret;
-- 
2.18.0


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

* [PATCH 2/2] dt-bindings: mediatek: mt8195: add memory-region property
  2021-11-30  5:39 [PATCH 0/2] ASoC: mediatek: support memory-region assignment Trevor Wu
  2021-11-30  5:39 ` [PATCH 1/2] ASoC: mediatek: mt8195: support reserved memory assignment Trevor Wu
@ 2021-11-30  5:39 ` Trevor Wu
  2021-12-06 18:00 ` [PATCH 0/2] ASoC: mediatek: support memory-region assignment Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Trevor Wu @ 2021-11-30  5:39 UTC (permalink / raw)
  To: broonie, tiwai, robh+dt, matthias.bgg
  Cc: devicetree, alsa-devel, linux-kernel, linux-mediatek, trevor.wu,
	yc.hung, linux-arm-kernel

Add a required property "memory-region", which is used to specify memory
for DMA usage.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
---
 .../devicetree/bindings/sound/mt8195-afe-pcm.yaml         | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/mt8195-afe-pcm.yaml b/Documentation/devicetree/bindings/sound/mt8195-afe-pcm.yaml
index dcf790b053d2..6d0975b33d15 100644
--- a/Documentation/devicetree/bindings/sound/mt8195-afe-pcm.yaml
+++ b/Documentation/devicetree/bindings/sound/mt8195-afe-pcm.yaml
@@ -19,6 +19,12 @@ properties:
   interrupts:
     maxItems: 1
 
+  memory-region:
+    maxItems: 1
+    description: |
+      Shared memory region for AFE memif.  A "shared-dma-pool".
+      See ../reserved-memory/reserved-memory.txt for details.
+
   mediatek,topckgen:
     $ref: "/schemas/types.yaml#/definitions/phandle"
     description: The phandle of the mediatek topckgen controller
@@ -125,6 +131,7 @@ required:
   - power-domains
   - clocks
   - clock-names
+  - memory-region
 
 additionalProperties: false
 
@@ -139,6 +146,7 @@ examples:
         interrupts = <GIC_SPI 822 IRQ_TYPE_LEVEL_HIGH 0>;
         mediatek,topckgen = <&topckgen>;
         power-domains = <&spm 7>; //MT8195_POWER_DOMAIN_AUDIO
+        memory-region = <&snd_dma_mem_reserved>;
         clocks = <&clk26m>,
                  <&topckgen 163>, //CLK_TOP_APLL1
                  <&topckgen 166>, //CLK_TOP_APLL2
-- 
2.18.0


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

* Re: [PATCH 0/2] ASoC: mediatek: support memory-region assignment
  2021-11-30  5:39 [PATCH 0/2] ASoC: mediatek: support memory-region assignment Trevor Wu
  2021-11-30  5:39 ` [PATCH 1/2] ASoC: mediatek: mt8195: support reserved memory assignment Trevor Wu
  2021-11-30  5:39 ` [PATCH 2/2] dt-bindings: mediatek: mt8195: add memory-region property Trevor Wu
@ 2021-12-06 18:00 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-12-06 18:00 UTC (permalink / raw)
  To: robh+dt, matthias.bgg, tiwai, Trevor Wu
  Cc: devicetree, alsa-devel, linux-kernel, linux-mediatek, yc.hung,
	linux-arm-kernel

On Tue, 30 Nov 2021 13:39:03 +0800, Trevor Wu wrote:
> This series of patches adds support for memory-region assignment, so the
> access region of DMA engine could be restricted.
> Patches are based on broonie tree "for-next" branch.
> 
> Trevor Wu (2):
>   ASoC: mediatek: mt8195: support reserved memory assignment
>   dt-bindings: mediatek: mt8195: add memory-region property
> 
> [...]

Applied to

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

Thanks!

[1/2] ASoC: mediatek: mt8195: support reserved memory assignment
      commit: 4d408ea0282c374a304ce402866cb7b8a56c6b05
[2/2] dt-bindings: mediatek: mt8195: add memory-region property
      commit: 2da636247bb6f4fc3a9842ade04757790753fd2c

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

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

end of thread, other threads:[~2021-12-06 18:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30  5:39 [PATCH 0/2] ASoC: mediatek: support memory-region assignment Trevor Wu
2021-11-30  5:39 ` [PATCH 1/2] ASoC: mediatek: mt8195: support reserved memory assignment Trevor Wu
2021-11-30  5:39 ` [PATCH 2/2] dt-bindings: mediatek: mt8195: add memory-region property Trevor Wu
2021-12-06 18:00 ` [PATCH 0/2] ASoC: mediatek: support memory-region assignment Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).