Linux Renesas SOC kernel development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: linux-renesas-soc@vger.kernel.org, dmaengine@vger.kernel.org,
	Vinod Koul <vinod.koul@intel.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH] dmaengine: rcar-dmac: unmap slave resource when channel is freed
Date: Wed, 11 Jan 2017 16:56 +0200	[thread overview]
Message-ID: <2176183.f66EgkImrW@avalon> (raw)
In-Reply-To: <20170111143931.9611-1-niklas.soderlund+renesas@ragnatech.se>

Hi Niklas,

Thank you for the patch.

On Wednesday 11 Jan 2017 15:39:31 Niklas Söderlund wrote:
> The slave mapping should be removed together with other channel
> resources when the channel is freed. If it's not unmapped it will hang
> around forever after the channel is freed.
> 
> Fixes: 9f878603dbdb7db3 ("dmaengine: rcar-dmac: add iommu support for slave
> transfers") Reported-by: Laurent Pinchart
> <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/dma/sh/rcar-dmac.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
> index 2e441d0ccd79..4c357d475465 100644
> --- a/drivers/dma/sh/rcar-dmac.c
> +++ b/drivers/dma/sh/rcar-dmac.c
> @@ -986,6 +986,7 @@ static void rcar_dmac_free_chan_resources(struct
> dma_chan *chan) {
>  	struct rcar_dmac_chan *rchan = to_rcar_dmac_chan(chan);
>  	struct rcar_dmac *dmac = to_rcar_dmac(chan->device);
> +	struct rcar_dmac_chan_map *map = &rchan->map;
>  	struct rcar_dmac_desc_page *page, *_page;
>  	struct rcar_dmac_desc *desc;
>  	LIST_HEAD(list);
> @@ -1019,6 +1020,13 @@ static void rcar_dmac_free_chan_resources(struct
> dma_chan *chan) free_page((unsigned long)page);
>  	}
> 
> +	/* Remove slave mapping if present. */
> +	if (map->slave.xfer_size) {
> +		dma_unmap_resource(chan->device->dev, map->addr,
> +				   map->slave.xfer_size, map->dir, 0);
> +		map->slave.xfer_size = 0;
> +	}
> +
>  	pm_runtime_put(chan->device->dev);
>  }

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2017-01-11 14:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11 14:39 [PATCH] dmaengine: rcar-dmac: unmap slave resource when channel is freed Niklas Söderlund
2017-01-11 14:56 ` Laurent Pinchart [this message]
2017-01-13 12:24 ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2176183.f66EgkImrW@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=arnd@arndb.de \
    --cc=dmaengine@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox