Re: [PATCH] gpu: host1x: Fix compiler errors
Hello, On Mon, May 14, 2018 at 10:43:08AM +0200, Thierry Reding wrote: > On Mon, Mar 26, 2018 at 04:44:14PM +0200, Emil Goode wrote: > > The compiler is complaining with the following errors: > > > > drivers/gpu/host1x/cdma.c:94:48: error: > > passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type > > [-Werror=incompatible-pointer-types] > > > > drivers/gpu/host1x/cdma.c:113:48: error: > > passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type > > [-Werror=incompatible-pointer-types] > > > > The expected pointer type of the third argument to dma_alloc_wc() is > > dma_addr_t but phys_addr_t is passed. Fix this by adding casts to the > > expected pointer type. > > > > Signed-off-by: Emil Goode > > --- > > drivers/gpu/host1x/cdma.c | 8 > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c > > index 28541b280739..5e8b321a751e 100644 > > --- a/drivers/gpu/host1x/cdma.c > > +++ b/drivers/gpu/host1x/cdma.c > > @@ -91,8 +91,8 @@ static int host1x_pushbuffer_init(struct push_buffer *pb) > > > > size = iova_align(&host1x->iova, size); > > > > - pb->mapped = dma_alloc_wc(host1x->dev, size, &pb->phys, > > - GFP_KERNEL); > > + pb->mapped = dma_alloc_wc(host1x->dev, size, > > + (dma_addr_t *)&pb->phys, GFP_KERNEL); > > if (!pb->mapped) > > return -ENOMEM; > > > > @@ -110,8 +110,8 @@ static int host1x_pushbuffer_init(struct push_buffer > > *pb) > > if (err) > > goto iommu_free_iova; > > } else { > > - pb->mapped = dma_alloc_wc(host1x->dev, size, &pb->phys, > > - GFP_KERNEL); > > + pb->mapped = dma_alloc_wc(host1x->dev, size, > > + (dma_addr_t *)&pb->phys, GFP_KERNEL); > > if (!pb->mapped) > > return -ENOMEM; > > > > This doesn't seem right. There's no guarantee that phys_addr_t and > dma_addr_t will be compatible, so the above isn't always correct. Also, > I don't see a need for pb->phys to ever be phys_addr_t. It's allocated > through dma_alloc_wc() exclusively, so it should just be dma_addr_t. I agree that this is a better solution, however when changing pb->phys to dma_addr_t the type will be wrong when it's passed to iommu_map() as phys_addr_t is expected but that doesn't cause a compilation error. > Note that the !pb->phys check in host1x_pushbuffer_destroy() becomes > technically wrong if pb->phys is dma_addr_t (0 is a perfectly valid > value for dma_addr_t), so make sure to flip that to !pb->mapped instead. > pb->mapped and pb->phys are always set in tandem, and checking mapped > for non-NULL is the right check to test whether the pair is valid or > not. Ok I will change this as well. Best regards, Emil ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2] gpu: host1x: Fix compiler errors by converting to dma_addr_t
The compiler is complaining with the following errors: drivers/gpu/host1x/cdma.c:94:48: error: passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type [-Werror=incompatible-pointer-types] drivers/gpu/host1x/cdma.c:113:48: error: passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type [-Werror=incompatible-pointer-types] The expected pointer type of the third argument to dma_alloc_wc() is dma_addr_t but phys_addr_t is passed. Change the phys member of struct push_buffer to be dma_addr_t so that we pass the correct type to dma_alloc_wc(). Also check pb->mapped for non-NULL in the destroy function as that is the right way of checking if dma_alloc_wc() was successful. Signed-off-by: Emil Goode --- v2: - Change the phys member type instead of adding casts. - Check pb->mapped in the destroy function as 0 is a valid value for dma_addr_t. drivers/gpu/host1x/cdma.c | 2 +- drivers/gpu/host1x/cdma.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c index 28541b280739..02a0b61be18f 100644 --- a/drivers/gpu/host1x/cdma.c +++ b/drivers/gpu/host1x/cdma.c @@ -51,7 +51,7 @@ static void host1x_pushbuffer_destroy(struct push_buffer *pb) struct host1x_cdma *cdma = pb_to_cdma(pb); struct host1x *host1x = cdma_to_host1x(cdma); - if (!pb->phys) + if (!pb->mapped) return; if (host1x->domain) { diff --git a/drivers/gpu/host1x/cdma.h b/drivers/gpu/host1x/cdma.h index 286d49386be9..446ee1a84969 100644 --- a/drivers/gpu/host1x/cdma.h +++ b/drivers/gpu/host1x/cdma.h @@ -44,7 +44,7 @@ struct host1x_job; struct push_buffer { void *mapped; /* mapped pushbuffer memory */ dma_addr_t dma; /* device address of pushbuffer */ - phys_addr_t phys; /* physical address of pushbuffer */ + dma_addr_t phys;/* physical address of pushbuffer */ u32 fence; /* index we've written */ u32 pos;/* index to write to */ u32 size; -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] gpu: host1x: Fix compiler errors
Hello, On Mon, Mar 26, 2018 at 04:57:34PM +0200, Thierry Reding wrote: > On Mon, Mar 26, 2018 at 04:44:14PM +0200, Emil Goode wrote: > > The compiler is complaining with the following errors: > > > > drivers/gpu/host1x/cdma.c:94:48: error: > > passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type > > [-Werror=incompatible-pointer-types] > > > > drivers/gpu/host1x/cdma.c:113:48: error: > > passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type > > [-Werror=incompatible-pointer-types] > > > > The expected pointer type of the third argument to dma_alloc_wc() is > > dma_addr_t but phys_addr_t is passed. Fix this by adding casts to the > > expected pointer type. > > > > Signed-off-by: Emil Goode > > --- > > drivers/gpu/host1x/cdma.c | 8 > > 1 file changed, 4 insertions(+), 4 deletions(-) > > What compiler do you use? I do regular builds and check for warnings and > errors, and this one is new to me. > > Thierry > I use gcc version 6.3.0 cross compiler for armhf supplied with Debian Stretch. Best regards, Emil > > > > diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c > > index 28541b280739..5e8b321a751e 100644 > > --- a/drivers/gpu/host1x/cdma.c > > +++ b/drivers/gpu/host1x/cdma.c > > @@ -91,8 +91,8 @@ static int host1x_pushbuffer_init(struct push_buffer *pb) > > > > size = iova_align(&host1x->iova, size); > > > > - pb->mapped = dma_alloc_wc(host1x->dev, size, &pb->phys, > > - GFP_KERNEL); > > + pb->mapped = dma_alloc_wc(host1x->dev, size, > > + (dma_addr_t *)&pb->phys, GFP_KERNEL); > > if (!pb->mapped) > > return -ENOMEM; > > > > @@ -110,8 +110,8 @@ static int host1x_pushbuffer_init(struct push_buffer > > *pb) > > if (err) > > goto iommu_free_iova; > > } else { > > - pb->mapped = dma_alloc_wc(host1x->dev, size, &pb->phys, > > - GFP_KERNEL); > > + pb->mapped = dma_alloc_wc(host1x->dev, size, > > + (dma_addr_t *)&pb->phys, GFP_KERNEL); > > if (!pb->mapped) > > return -ENOMEM; > > > > -- > > 2.11.0 > > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] gpu: host1x: Fix compiler errors
The compiler is complaining with the following errors: drivers/gpu/host1x/cdma.c:94:48: error: passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type [-Werror=incompatible-pointer-types] drivers/gpu/host1x/cdma.c:113:48: error: passing argument 3 of ‘dma_alloc_wc’ from incompatible pointer type [-Werror=incompatible-pointer-types] The expected pointer type of the third argument to dma_alloc_wc() is dma_addr_t but phys_addr_t is passed. Fix this by adding casts to the expected pointer type. Signed-off-by: Emil Goode --- drivers/gpu/host1x/cdma.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c index 28541b280739..5e8b321a751e 100644 --- a/drivers/gpu/host1x/cdma.c +++ b/drivers/gpu/host1x/cdma.c @@ -91,8 +91,8 @@ static int host1x_pushbuffer_init(struct push_buffer *pb) size = iova_align(&host1x->iova, size); - pb->mapped = dma_alloc_wc(host1x->dev, size, &pb->phys, - GFP_KERNEL); + pb->mapped = dma_alloc_wc(host1x->dev, size, + (dma_addr_t *)&pb->phys, GFP_KERNEL); if (!pb->mapped) return -ENOMEM; @@ -110,8 +110,8 @@ static int host1x_pushbuffer_init(struct push_buffer *pb) if (err) goto iommu_free_iova; } else { - pb->mapped = dma_alloc_wc(host1x->dev, size, &pb->phys, - GFP_KERNEL); + pb->mapped = dma_alloc_wc(host1x->dev, size, + (dma_addr_t *)&pb->phys, GFP_KERNEL); if (!pb->mapped) return -ENOMEM; -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] gma500: Remove unused variable
This patch removes a unused struct psb_intel_connector Sparse gives a warning: drivers/gpu/drm/gma500/cdv_intel_hdmi.c:142:30: warning: unused variable ?psb_intel_connector? [-Wunused-variable] Signed-off-by: Emil Goode --- drivers/gpu/drm/gma500/cdv_intel_hdmi.c |2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c index b1b77bb..7272a46 100644 --- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c +++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c @@ -139,8 +139,6 @@ static enum drm_connector_status cdv_hdmi_detect( { struct psb_intel_encoder *psb_intel_encoder = psb_intel_attached_encoder(connector); - struct psb_intel_connector *psb_intel_connector = - to_psb_intel_connector(connector); struct mid_intel_hdmi_priv *hdmi_priv = psb_intel_encoder->dev_priv; struct edid *edid = NULL; enum drm_connector_status status = connector_status_disconnected; -- 1.7.10.4
[PATCH] gma500: Remove unused variable
This patch removes a unused struct psb_intel_connector Sparse gives a warning: drivers/gpu/drm/gma500/cdv_intel_hdmi.c:142:30: warning: unused variable ‘psb_intel_connector’ [-Wunused-variable] Signed-off-by: Emil Goode --- drivers/gpu/drm/gma500/cdv_intel_hdmi.c |2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c index b1b77bb..7272a46 100644 --- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c +++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c @@ -139,8 +139,6 @@ static enum drm_connector_status cdv_hdmi_detect( { struct psb_intel_encoder *psb_intel_encoder = psb_intel_attached_encoder(connector); - struct psb_intel_connector *psb_intel_connector = - to_psb_intel_connector(connector); struct mid_intel_hdmi_priv *hdmi_priv = psb_intel_encoder->dev_priv; struct edid *edid = NULL; enum drm_connector_status status = connector_status_disconnected; -- 1.7.10.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/exynos: Include missing linux/types.h in header
Include the linux/types.h file where used types are declared. Sparse gives the following warning: /usr/include/drm/exynos_drm.h:92: found __[us]{8,16,32,64} type without #include Signed-off-by: Emil Goode --- include/drm/exynos_drm.h |2 ++ 1 file changed, 2 insertions(+) diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h index e478de4..7eb7ae7 100644 --- a/include/drm/exynos_drm.h +++ b/include/drm/exynos_drm.h @@ -29,6 +29,8 @@ #ifndef _EXYNOS_DRM_H_ #define _EXYNOS_DRM_H_ +#include + /** * User-desired buffer creation information structure. * -- 1.7.10 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/tegra: Include header drm/drm.h
Include definitions of used types by including drm/drm.h Sparse output: /usr/include/drm/tegra_drm.h:21: found __[us]{8,16,32,64} type without #include Signed-off-by: Emil Goode --- include/uapi/drm/tegra_drm.h |2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h index 6e132a2..73bde4e 100644 --- a/include/uapi/drm/tegra_drm.h +++ b/include/uapi/drm/tegra_drm.h @@ -17,6 +17,8 @@ #ifndef _UAPI_TEGRA_DRM_H_ #define _UAPI_TEGRA_DRM_H_ +#include + struct drm_tegra_gem_create { __u64 size; __u32 flags; -- 1.7.10.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/tegra: Include header drm/drm.h
Hi Thierry, I don't know this code well but the drm/drm.h has an #if def so that either linux/types.h is included or the __[us]* types are defined in a different way with the comment "One of the BSDs". Also I sent a patch last year to include linux/types.h in exynos_drm.h but it now includes drm/drm.h instead. Best regards, Emil Goode On Fri, Apr 26, 2013 at 09:22:08PM +0200, Thierry Reding wrote: > On Fri, Apr 26, 2013 at 07:49:51PM +0200, Emil Goode wrote: > > Include definitions of used types by including drm/drm.h > > > > Sparse output: > > /usr/include/drm/tegra_drm.h:21: > > found __[us]{8,16,32,64} type without > > #include > > > > Signed-off-by: Emil Goode > > --- > > include/uapi/drm/tegra_drm.h |2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h > > index 6e132a2..73bde4e 100644 > > --- a/include/uapi/drm/tegra_drm.h > > +++ b/include/uapi/drm/tegra_drm.h > > @@ -17,6 +17,8 @@ > > #ifndef _UAPI_TEGRA_DRM_H_ > > #define _UAPI_TEGRA_DRM_H_ > > > > +#include > > + > > sparse complains about linux/types.h not being included, so I wonder if > it makes more sense to include that instead of drm/drm.h. In fact I have > a fix that does exactly that in a local branch and was going to put that > into my fixes branch. It's a bit more lightweight. > > On the other hand, some drivers already include drm/drm.h in the public > header so I don't really have any objections to this patch. > > Thierry ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/tegra: Include header drm/drm.h
Include definitions of used types by including drm/drm.h Sparse output: /usr/include/drm/tegra_drm.h:21: found __[us]{8,16,32,64} type without #include Signed-off-by: Emil Goode --- include/uapi/drm/tegra_drm.h |2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h index 6e132a2..73bde4e 100644 --- a/include/uapi/drm/tegra_drm.h +++ b/include/uapi/drm/tegra_drm.h @@ -17,6 +17,8 @@ #ifndef _UAPI_TEGRA_DRM_H_ #define _UAPI_TEGRA_DRM_H_ +#include + struct drm_tegra_gem_create { __u64 size; __u32 flags; -- 1.7.10.4
[PATCH] drm/tegra: Include header drm/drm.h
Hi Thierry, I don't know this code well but the drm/drm.h has an #if def so that either linux/types.h is included or the __[us]* types are defined in a different way with the comment "One of the BSDs". Also I sent a patch last year to include linux/types.h in exynos_drm.h but it now includes drm/drm.h instead. Best regards, Emil Goode On Fri, Apr 26, 2013 at 09:22:08PM +0200, Thierry Reding wrote: > On Fri, Apr 26, 2013 at 07:49:51PM +0200, Emil Goode wrote: > > Include definitions of used types by including drm/drm.h > > > > Sparse output: > > /usr/include/drm/tegra_drm.h:21: > > found __[us]{8,16,32,64} type without > > #include > > > > Signed-off-by: Emil Goode > > --- > > include/uapi/drm/tegra_drm.h |2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h > > index 6e132a2..73bde4e 100644 > > --- a/include/uapi/drm/tegra_drm.h > > +++ b/include/uapi/drm/tegra_drm.h > > @@ -17,6 +17,8 @@ > > #ifndef _UAPI_TEGRA_DRM_H_ > > #define _UAPI_TEGRA_DRM_H_ > > > > +#include > > + > > sparse complains about linux/types.h not being included, so I wonder if > it makes more sense to include that instead of drm/drm.h. In fact I have > a fix that does exactly that in a local branch and was going to put that > into my fixes branch. It's a bit more lightweight. > > On the other hand, some drivers already include drm/drm.h in the public > header so I don't really have any objections to this patch. > > Thierry
[PATCH v2 1/3] drm/tegra: Relicense public header under MIT
Hello Thierry, On Thu, Feb 20, 2014 at 04:48:10PM +0100, Thierry Reding wrote: > From: Thierry Reding > > This file will eventually be exported to libdrm, where all the public > header files use the MIT license. > > Reported-by: Erik Faye-Lund > Acked-by: Stephen Warren > Signed-off-by: Thierry Reding > --- > Changes in v2: > - use generic MIT license header (not mentioning Tungsten Graphics) > > include/uapi/drm/tegra_drm.h | 24 +++- > 1 file changed, 15 insertions(+), 9 deletions(-) > > diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h > index 5e1ab552cbed..b042b48495d9 100644 > --- a/include/uapi/drm/tegra_drm.h > +++ b/include/uapi/drm/tegra_drm.h > @@ -1,17 +1,23 @@ > /* > * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved. > * > - * This program is free software; you can redistribute it and/or modify it > - * under the terms and conditions of the GNU General Public License, > - * version 2, as published by the Free Software Foundation. > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the "Software"), > + * to deal in the Software without restriction, including without limitation > + * the rights to use, copy, modify, merge, publish, distribute, sublicense, > + * and/or sell copies of the Software, and to permit persons to whom the > + * Software is furnished to do so, subject to the following conditions: > * > - * This program is distributed in the hope it will be useful, but WITHOUT > - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > - * more details. > + * The above copyright notice and this permission notice shall be included in > + * all copies or substantial portions of the Software. > * > - * You should have received a copy of the GNU General Public License > - * along with this program. If not, see <http://www.gnu.org/licenses/>. > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR > + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR > + * OTHER DEALINGS IN THE SOFTWARE. > */ My contribution was tiny, otherwise I prefer GPL over MIT :) Acked-by: Emil Goode Best regards, Emil
[PATCH] drm/exynos: Include missing linux/types.h in header
Include the linux/types.h file where used types are declared. Sparse gives the following warning: /usr/include/drm/exynos_drm.h:92: found __[us]{8,16,32,64} type without #include Signed-off-by: Emil Goode --- include/drm/exynos_drm.h |2 ++ 1 file changed, 2 insertions(+) diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h index e478de4..7eb7ae7 100644 --- a/include/drm/exynos_drm.h +++ b/include/drm/exynos_drm.h @@ -29,6 +29,8 @@ #ifndef _EXYNOS_DRM_H_ #define _EXYNOS_DRM_H_ +#include + /** * User-desired buffer creation information structure. * -- 1.7.10