linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shawn Guo <shawn.guo@linaro.org>
To: Jordan Crouse <jcrouse@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org,
	AngeloGioacchino Del Regno <kholk11@gmail.com>,
	Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
	Drew Davenport <ddavenport@chromium.org>,
	Georgi Djakov <georgi.djakov@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jeffrey Hugo <jeffrey.l.hugo@gmail.com>,
	Kalyan Thota <kalyan_t@codeaurora.org>,
	Rob Clark <robdclark@gmail.com>, Sam Ravnborg <sam@ravnborg.org>,
	Sean Paul <sean@poorly.run>, Thomas Gleixner <tglx@linutronix.de>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Wambui Karuga <wambui.karugax@gmail.com>,
	dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
	linux-kernel@vger.kernel.org,
	tongtiangen <tongtiangen@huawei.com>
Subject: Re: [PATCH v1 1/3] drm/msm: Attach the IOMMU device during initialization
Date: Sat, 23 May 2020 15:23:02 +0800	[thread overview]
Message-ID: <20200523072300.GB28198@dragon> (raw)
In-Reply-To: <20200522220316.23772-2-jcrouse@codeaurora.org>

On Fri, May 22, 2020 at 04:03:14PM -0600, Jordan Crouse wrote:
> diff --git a/drivers/gpu/drm/msm/msm_gpummu.c b/drivers/gpu/drm/msm/msm_gpummu.c
> index 34980d8eb7ad..0ad0f848560a 100644
> --- a/drivers/gpu/drm/msm/msm_gpummu.c
> +++ b/drivers/gpu/drm/msm/msm_gpummu.c
> @@ -21,11 +21,6 @@ struct msm_gpummu {
>  #define GPUMMU_PAGE_SIZE SZ_4K
>  #define TABLE_SIZE (sizeof(uint32_t) * GPUMMU_VA_RANGE / GPUMMU_PAGE_SIZE)
>  
> -static int msm_gpummu_attach(struct msm_mmu *mmu)
> -{
> -	return 0;
> -}
> -
>  static void msm_gpummu_detach(struct msm_mmu *mmu)
>  {
>  }
> @@ -85,7 +80,6 @@ static void msm_gpummu_destroy(struct msm_mmu *mmu)
>  }
>  
>  static const struct msm_mmu_funcs funcs = {
> -		.attach = msm_gpummu_attach,
>  		.detach = msm_gpummu_detach,
>  		.map = msm_gpummu_map,
>  		.unmap = msm_gpummu_unmap,
> diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
> index ad58cfe5998e..e35dab5792cf 100644
> --- a/drivers/gpu/drm/msm/msm_iommu.c
> +++ b/drivers/gpu/drm/msm/msm_iommu.c
> @@ -66,7 +66,6 @@ static void msm_iommu_destroy(struct msm_mmu *mmu)
>  }
>  
>  static const struct msm_mmu_funcs funcs = {
> -		.attach = msm_iommu_attach,

It causes an unused function warning as below.

drivers/gpu/drm/msm/msm_iommu.c:26:12: warning: ‘msm_iommu_attach’ defined but not used [-Wunused-function]
 static int msm_iommu_attach(struct msm_mmu *mmu)
            ^~~~~~~~~~~~~~~~

Not sure if you will use it again in future patches though.

Shawn

>  		.detach = msm_iommu_detach,
>  		.map = msm_iommu_map,
>  		.unmap = msm_iommu_unmap,
> @@ -76,6 +75,7 @@ static const struct msm_mmu_funcs funcs = {
>  struct msm_mmu *msm_iommu_new(struct device *dev, struct iommu_domain *domain)
>  {
>  	struct msm_iommu *iommu;
> +	int ret;
>  
>  	iommu = kzalloc(sizeof(*iommu), GFP_KERNEL);
>  	if (!iommu)
> @@ -85,5 +85,11 @@ struct msm_mmu *msm_iommu_new(struct device *dev, struct iommu_domain *domain)
>  	msm_mmu_init(&iommu->base, dev, &funcs);
>  	iommu_set_fault_handler(domain, msm_fault_handler, iommu);
>  
> +	ret = iommu_attach_device(iommu->domain, dev);
> +	if (ret) {
> +		kfree(iommu);
> +		return ERR_PTR(ret);
> +	}
> +
>  	return &iommu->base;
>  }
> diff --git a/drivers/gpu/drm/msm/msm_mmu.h b/drivers/gpu/drm/msm/msm_mmu.h
> index 67a623f14319..bae9e8e67ec1 100644
> --- a/drivers/gpu/drm/msm/msm_mmu.h
> +++ b/drivers/gpu/drm/msm/msm_mmu.h
> @@ -10,7 +10,6 @@
>  #include <linux/iommu.h>
>  
>  struct msm_mmu_funcs {
> -	int (*attach)(struct msm_mmu *mmu);
>  	void (*detach)(struct msm_mmu *mmu);
>  	int (*map)(struct msm_mmu *mmu, uint64_t iova, struct sg_table *sgt,
>  			unsigned len, int prot);
> -- 
> 2.17.1
> 

  reply	other threads:[~2020-05-23  7:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22 22:03 [PATCH v1 0/3] drm/msm: Cleanups ahead of per-instance pagetables Jordan Crouse
2020-05-22 22:03 ` [PATCH v1 1/3] drm/msm: Attach the IOMMU device during initialization Jordan Crouse
2020-05-23  7:23   ` Shawn Guo [this message]
2020-05-23 23:19     ` Rob Clark
2020-05-22 22:03 ` [PATCH v1 2/3] drm/msm: Refactor address space initialization Jordan Crouse
2020-05-22 22:03 ` [PATCH v1 3/3] drm/msm: Update the MMU helper function APIs Jordan Crouse
2020-05-23  7:19 ` [PATCH v1 0/3] drm/msm: Cleanups ahead of per-instance pagetables Shawn Guo

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=20200523072300.GB28198@dragon \
    --to=shawn.guo@linaro.org \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=ddavenport@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=georgi.djakov@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jcrouse@codeaurora.org \
    --cc=jeffrey.l.hugo@gmail.com \
    --cc=kalyan_t@codeaurora.org \
    --cc=kholk11@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@gmail.com \
    --cc=sam@ravnborg.org \
    --cc=sean@poorly.run \
    --cc=tglx@linutronix.de \
    --cc=tongtiangen@huawei.com \
    --cc=tzimmermann@suse.de \
    --cc=wambui.karugax@gmail.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;
as well as URLs for NNTP newsgroup(s).