[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200523072300.GB28198@dragon>
Date: Sat, 23 May 2020 15:23:02 +0800
From: Shawn Guo <shawn.guo@...aro.org>
To: Jordan Crouse <jcrouse@...eaurora.org>
Cc: linux-arm-msm@...r.kernel.org,
AngeloGioacchino Del Regno <kholk11@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
David Airlie <airlied@...ux.ie>,
Drew Davenport <ddavenport@...omium.org>,
Georgi Djakov <georgi.djakov@...aro.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jeffrey Hugo <jeffrey.l.hugo@...il.com>,
Kalyan Thota <kalyan_t@...eaurora.org>,
Rob Clark <robdclark@...il.com>,
Sam Ravnborg <sam@...nborg.org>, Sean Paul <sean@...rly.run>,
Thomas Gleixner <tglx@...utronix.de>,
Thomas Zimmermann <tzimmermann@...e.de>,
Wambui Karuga <wambui.karugax@...il.com>,
dri-devel@...ts.freedesktop.org, freedreno@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, tongtiangen <tongtiangen@...wei.com>
Subject: Re: [PATCH v1 1/3] drm/msm: Attach the IOMMU device during
initialization
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
>
Powered by blists - more mailing lists