[Intel-gfx] [PATCH] drm/i915/gvt: Annotate iomem usage
Zhenyu Wang
zhenyuw at linux.intel.com
Thu Apr 4 07:42:50 UTC 2019
On 2019.04.04 08:14:25 +0100, Chris Wilson wrote:
> Fix the sparse warning for blithely using iomem with normal memcpy:
>
> drivers/gpu/drm/i915/gvt/kvmgt.c:916:21: warning: incorrect type in assignment (different address spaces)
> drivers/gpu/drm/i915/gvt/kvmgt.c:916:21: expected void *aperture_va
> drivers/gpu/drm/i915/gvt/kvmgt.c:916:21: got void [noderef] <asn:2> *
> drivers/gpu/drm/i915/gvt/kvmgt.c:927:26: warning: incorrect type in argument 1 (different address spaces)
> drivers/gpu/drm/i915/gvt/kvmgt.c:927:26: expected void [noderef] <asn:2> *vaddr
> drivers/gpu/drm/i915/gvt/kvmgt.c:927:26: got void *aperture_va
>
> Fixes: d480b28a41a6 ("drm/i915/gvt: Fix aperture read/write emulation when enable x-no-mmap=on")
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Zhenyu Wang <zhenyuw at linux.intel.com>
> Cc: Changbin Du <changbin.du at intel.com>
> Cc: Zhi Wang <zhi.a.wang at intel.com>
> ---
> drivers/gpu/drm/i915/gvt/kvmgt.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index d5fcc447d22f..a68addf95c23 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -905,7 +905,7 @@ static inline bool intel_vgpu_in_aperture(struct intel_vgpu *vgpu, u64 off)
> static int intel_vgpu_aperture_rw(struct intel_vgpu *vgpu, u64 off,
> void *buf, unsigned long count, bool is_write)
> {
> - void *aperture_va;
> + void __iomem *aperture_va;
>
> if (!intel_vgpu_in_aperture(vgpu, off) ||
> !intel_vgpu_in_aperture(vgpu, off + count)) {
> @@ -920,9 +920,9 @@ static int intel_vgpu_aperture_rw(struct intel_vgpu *vgpu, u64 off,
> return -EIO;
>
> if (is_write)
> - memcpy(aperture_va + offset_in_page(off), buf, count);
> + memcpy_toio(aperture_va + offset_in_page(off), buf, count);
> else
> - memcpy(buf, aperture_va + offset_in_page(off), count);
> + memcpy_fromio(buf, aperture_va + offset_in_page(off), count);
>
> io_mapping_unmap(aperture_va);
>
> --
Reviewed-by: Zhenyu Wang <zhenyuw at linux.intel.com>
thanks!
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20190404/3fcb257e/attachment.sig>
More information about the Intel-gfx
mailing list